public function __construct(Contact $model = null, $attributeName = null) { assert('$model != null'); assert('$attributeName != null && is_string($attributeName)'); parent::__construct($model, $attributeName); $this->contactStatesData = ContactsUtil::getContactStateDataKeyedByOrder(); $this->contactStatesLabels = ContactsUtil::getContactStateLabelsKeyedByLanguageAndOrder(); $startingState = ContactsUtil::getStartingState(); $this->startingStateOrder = $startingState->order; }
public function __construct(RedBeanModel $model = null, $attributeName = null) { parent::__construct($model, $attributeName); if ($model !== null) { $maxLength = StringValidatorHelper::getMaxLengthByModelAndAttributeName($model, $attributeName); if ($maxLength !== null) { $this->maxLength = $maxLength; } } }
/** * Override needed to translate defaultValueCalculationType rule to the defaultValueCalculationType. */ public function __construct(RedBeanModel $model = null, $attributeName = null) { parent::__construct($model, $attributeName); if ($model !== null) { $validators = $model->getValidators($attributeName); foreach ($validators as $validator) { if ($validator instanceof RedBeanModelDateTimeDefaultValueValidator) { $this->defaultValueCalculationType = $validator->value; } } } }
/** * Override needed to translate defaultValue to the order. Order corresponds to the keyed index of the * customFieldDataData array. This is needed for the form to operate correctly in the user interface. * Otherwise if you select a default as a new pick list item, the user interface has no way of posting * the correct Id for the defaultValue since the new pick list item has not been created yet. * Also need override to properly adapt pick list items. */ public function __construct(RedBeanModel $model = null, $attributeName = null) { parent::__construct($model, $attributeName); if ($model !== null) { $this->customFieldDataName = $model->{$attributeName}->data->name; $this->customFieldDataId = $model->{$attributeName}->data->id; $this->customFieldDataData = unserialize($model->{$attributeName}->data->serializedData); if ($model->{$attributeName}->data->serializedLabels !== null) { $this->customFieldDataLabels = unserialize($model->{$attributeName}->data->serializedLabels); } $this->defaultValueOrder = DropDownDefaultValueOrderUtil::getDefaultValueOrderFromDefaultValue($this->defaultValue, $this->customFieldDataData); } }