mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
N°2313 - Markup extensibility: Add field label in its metadata
This commit is contained in:
@@ -839,6 +839,7 @@ EOF
|
|||||||
{
|
{
|
||||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
||||||
$sAttDefClass = get_class($oAttDef);
|
$sAttDefClass = get_class($oAttDef);
|
||||||
|
$sAttLabel = MetaModel::GetLabel($sClass, $sAttCode);
|
||||||
|
|
||||||
if ($bEditMode)
|
if ($bEditMode)
|
||||||
{
|
{
|
||||||
@@ -941,6 +942,7 @@ EOF
|
|||||||
// - Attribute code and AttributeDef. class
|
// - Attribute code and AttributeDef. class
|
||||||
$val['attcode'] = $sAttCode;
|
$val['attcode'] = $sAttCode;
|
||||||
$val['atttype'] = $sAttDefClass;
|
$val['atttype'] = $sAttDefClass;
|
||||||
|
$val['attlabel'] = $sAttLabel;
|
||||||
|
|
||||||
// - How the field should be rendered
|
// - How the field should be rendered
|
||||||
$val['layout'] = (in_array($oAttDef->GetEditClass(), static::GetAttEditClassesToRenderAsLargeField())) ? 'large' : 'small';
|
$val['layout'] = (in_array($oAttDef->GetEditClass(), static::GetAttEditClassesToRenderAsLargeField())) ? 'large' : 'small';
|
||||||
|
|||||||
@@ -510,9 +510,10 @@ class WebPage implements Page
|
|||||||
$sLayout = isset($aAttrib['layout']) ? $aAttrib['layout'] : 'small';
|
$sLayout = isset($aAttrib['layout']) ? $aAttrib['layout'] : 'small';
|
||||||
$sDataAttributeCode = isset($aAttrib['attcode']) ? 'data-attribute-code="'.$aAttrib['attcode'].'"' : '';
|
$sDataAttributeCode = isset($aAttrib['attcode']) ? 'data-attribute-code="'.$aAttrib['attcode'].'"' : '';
|
||||||
$sDataAttributeType = isset($aAttrib['atttype']) ? 'data-attribute-type="'.$aAttrib['atttype'].'"' : '';
|
$sDataAttributeType = isset($aAttrib['atttype']) ? 'data-attribute-type="'.$aAttrib['atttype'].'"' : '';
|
||||||
|
$sDataAttributeLabel = isset($aAttrib['attlabel']) ? 'data-attribute-label="'.utils::HtmlEntities($aAttrib['attlabel']).'"' : '';
|
||||||
$sDataValueRaw = isset($aAttrib['value_raw']) ? 'data-value-raw="'.$aAttrib['value_raw'].'"' : '';
|
$sDataValueRaw = isset($aAttrib['value_raw']) ? 'data-value-raw="'.$aAttrib['value_raw'].'"' : '';
|
||||||
|
|
||||||
$sHtml .= "<div class=\"field_container field_{$sLayout}\" $sDataAttributeCode $sDataAttributeType $sDataValueRaw>\n";
|
$sHtml .= "<div class=\"field_container field_{$sLayout}\" $sDataAttributeCode $sDataAttributeType $sDataAttributeLabel $sDataValueRaw>\n";
|
||||||
$sHtml .= "<div class=\"field_label label\">{$aAttrib['label']}</div>\n";
|
$sHtml .= "<div class=\"field_label label\">{$aAttrib['label']}</div>\n";
|
||||||
|
|
||||||
$sHtml .= "<div class=\"field_data\">\n";
|
$sHtml .= "<div class=\"field_data\">\n";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Copyright (C) 2013-2019 Combodo SARL
|
* Copyright (C) 2013-2020 Combodo SARL
|
||||||
*
|
*
|
||||||
* This file is part of iTop.
|
* This file is part of iTop.
|
||||||
*
|
*
|
||||||
@@ -1028,7 +1028,8 @@ abstract class AttributeDefinition
|
|||||||
// Metadata
|
// Metadata
|
||||||
$oFormField->AddMetadata('attribute-code', $this->GetCode());
|
$oFormField->AddMetadata('attribute-code', $this->GetCode());
|
||||||
$oFormField->AddMetadata('attribute-type', get_class($this));
|
$oFormField->AddMetadata('attribute-type', get_class($this));
|
||||||
if($this::IsScalar())
|
$oFormField->AddMetadata('attribute-label', $this->GetLabel());
|
||||||
|
if ($this::IsScalar())
|
||||||
{
|
{
|
||||||
$oFormField->AddMetadata('value-raw', $oObject->Get($this->GetCode()));
|
$oFormField->AddMetadata('value-raw', $oObject->Get($this->GetCode()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user