Add UIBlocks to twig (CollapsibleSection, FieldBadge, Panel)

This commit is contained in:
Eric
2021-01-15 10:12:02 +01:00
parent 63eb0f1530
commit 5fe8ca178e
10 changed files with 60 additions and 29 deletions

View File

@@ -17,7 +17,7 @@
* You should have received a copy of the GNU Affero General Public License
*/
use Combodo\iTop\Application\UI\Base\Component\FieldBadge\FieldBadgeFactory;
use Combodo\iTop\Application\UI\Base\Component\FieldBadge\FieldBadgeUIBlockFactory;
use Combodo\iTop\Form\Field\LabelField;
use Combodo\iTop\Form\Field\TextAreaField;
use Combodo\iTop\Form\Validator\NotEmptyExtKeyValidator;
@@ -5349,14 +5349,13 @@ class AttributeEnum extends AttributeString
public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true)
{
if ($bLocalize)
{
if ($bLocalize) {
$sLabel = $this->GetValueLabel($sValue);
// $sDescription = $this->GetValueDescription($sValue);
$oStyle = $this->GetStyle($sValue);
// later, we could imagine a detailed description in the title
// $sRes = "<span title=\"$sDescription\">".parent::GetAsHtml($sLabel)."</span>";
$oBadge = FieldBadgeFactory::MakeForField($sLabel, $oStyle);
$oBadge = FieldBadgeUIBlockFactory::MakeForField($sLabel, $oStyle);
$oRenderer = new BlockRenderer($oBadge);
$sRes = $oRenderer->RenderHtml();
}