To create a MetaModelAttribute instance, use the {@link MetaModelAttributeFactory} This class is the reference implementation for {@link IMetaModelAttribute}.
Inheritance: implements MetaModels\Attribute\IAttribute
 /**
  * {@inheritDoc}
  */
 public function getFieldDefinition($arrOverrides = array())
 {
     $strActiveLanguage = $this->getMetaModel()->getActiveLanguage();
     $strFallbackLanguage = $this->getMetaModel()->getFallbackLanguage();
     $arrAllColLabels = deserialize($this->get('translatedtabletext_cols'), true);
     $arrColLabels = null;
     if (array_key_exists($strActiveLanguage, $arrAllColLabels)) {
         $arrColLabels = $arrAllColLabels[$strActiveLanguage];
     } elseif (array_key_exists($strActiveLanguage, $strFallbackLanguage)) {
         $arrColLabels = $arrAllColLabels[$strFallbackLanguage];
     } else {
         $arrColLabels = array_pop(array_reverse($arrAllColLabels));
     }
     // Build DCA.
     $arrFieldDef = parent::getFieldDefinition($arrOverrides);
     $arrFieldDef['inputType'] = 'multiColumnWizard';
     $arrFieldDef['eval']['columnFields'] = array();
     $count = count($arrColLabels);
     for ($i = 0; $i < $count; $i++) {
         $arrFieldDef['eval']['columnFields']['col_' . $i] = array('label' => $arrColLabels[$i]['rowLabel'], 'inputType' => 'text', 'eval' => array());
         if ($arrColLabels[$i]['rowStyle']) {
             $arrFieldDef['eval']['columnFields']['col_' . $i]['eval']['style'] = 'width:' . $arrColLabels[$i]['rowStyle'];
         }
     }
     return $arrFieldDef;
 }
Example #2
0
 /**
  * Delete all auxiliary data like a column in the MetaModel table or references in another table etc.
  *
  * @return void
  */
 public function initializeAUX()
 {
     parent::initializeAUX();
     $this->createColumn();
 }