*/ class BsSetFieldRenderer extends BsFieldRenderer { /** * @inheritDoc */ public function Render() { $oOutput = parent::Render(); $sFieldMandatoryClass = ($this->oField->GetMandatory()) ? 'form_mandatory' : ''; $sFieldDescriptionForHTMLTag = ($this->oField->HasDescription()) ? 'data-tooltip-content="'.utils::HtmlEntities($this->oField->GetDescription()).'"' : ''; // Vars to build the table // $sAttributesToDisplayAsJson = json_encode($this->oField->GetAttributesToDisplay()); // $sAttCodesToDisplayAsJson = json_encode($this->oField->GetAttributesToDisplay(true)); // $aItems = array(); // $aItemIds = array(); // $this->PrepareItems($aItems, $aItemIds); // $sItemsAsJson = json_encode($aItems); // $sItemIdsAsJson = htmlentities(json_encode(array('current' => $aItemIds)), ENT_QUOTES, 'UTF-8'); // Rendering field if (!$this->oField->GetHidden()) { /** @var \ormSet $oOrmItemSet */ $oOrmItemSet = $this->oField->GetCurrentValue(); // Opening container $oOutput->AddHtml('
'); // Label $oOutput->AddHtml('
'); if ($this->oField->GetLabel() !== '') { $oOutput->AddHtml(''); } $oOutput->AddHtml('
'); // Value $oOutput->AddHtml('
'); // ... in edit mode if(!$this->oField->GetReadOnly()) { $oAttDef = MetaModel::GetAttributeDef($oOrmItemSet->GetClass(), $oOrmItemSet->GetAttCode()); $sJSONForWidget = $oAttDef->GetJsonForWidget($oOrmItemSet); // - Help block $oOutput->AddHtml('
'); // - Value regarding the field type $oOutput->AddHtml(''); // Attaching JS widget only if field is hidden or NOT read only // JS Form field widget construct $aValidators = array(); $sValidators = json_encode($aValidators); $oOutput->AddJs( <<oField->GetGlobalId()}').val(); return value; }, }); EOF ); } // ... in view mode else { $aItems = $oOrmItemSet->GetTags(); $oOutput->AddHtml('
') ->AddHtml(''); foreach($aItems as $sItemCode => $oItem) { $sItemLabel = $oItem->Get('label'); $sItemDescription = $oItem->Get('description'); $oOutput->AddHtml('') ->AddHtml($sItemLabel, true) ->AddHtml(''); } $oOutput->AddHtml('') ->AddHtml('
'); } $oOutput->AddHtml('
'); } return $oOutput; } }