/**
  * Populates a new component instance by its type and model.
  *
  * @param string $type
  * @param BaseComponentModel $model
  * @return BaseComponentType|null
  */
 public function populateComponentByTypeAndModel($type, BaseComponentModel $model)
 {
     $component = $this->getComponentByTypeAndClass($type, $model->type);
     if ($component) {
         $component->model = $model;
         if ($model->settings) {
             $component->setSettings($model->settings);
         }
         if ($model->hasSettingErrors()) {
             $component->getSettings()->addErrors($model->getSettingErrors());
         }
         return $component;
     }
 }
 /**
  * @access protected
  * @return array
  */
 protected function defineAttributes()
 {
     $attributes = parent::defineAttributes();
     $attributes['name'] = AttributeType::String;
     $attributes['type']['default'] = 'Local';
     $attributes['sortOrder'] = AttributeType::String;
     return $attributes;
 }
 /**
  * @inheritDoc BaseModel::defineAttributes()
  *
  * @return array
  */
 protected function defineAttributes()
 {
     $attributes = parent::defineAttributes();
     $attributes['name'] = AttributeType::String;
     $attributes['handle'] = AttributeType::Handle;
     $attributes['type']['default'] = 'Local';
     $attributes['sortOrder'] = AttributeType::String;
     $attributes['fieldLayoutId'] = AttributeType::Number;
     return $attributes;
 }
Example #4
0
 /**
  * @inheritDoc BaseModel::defineAttributes()
  *
  * @return array
  */
 protected function defineAttributes()
 {
     return array_merge(parent::defineAttributes(), array('colspan' => AttributeType::Number));
 }
Example #5
0
 /**
  * @access protected
  * @return array
  */
 protected function defineAttributes()
 {
     return array_merge(parent::defineAttributes(), array('groupId' => AttributeType::Number, 'name' => AttributeType::String, 'handle' => AttributeType::String, 'instructions' => AttributeType::String, 'required' => AttributeType::Bool, 'translatable' => AttributeType::Bool));
 }
 protected function defineAttributes()
 {
     return array_merge(parent::defineAttributes(), array('fieldId' => AttributeType::Number, 'fieldLayoutId' => AttributeType::Number, 'name' => AttributeType::String, 'instructions' => AttributeType::String));
 }
Example #7
0
 /**
  * @inheritDoc BaseModel::defineAttributes()
  *
  * @return array
  */
 protected function defineAttributes()
 {
     return array_merge(parent::defineAttributes(), array('level' => AttributeType::Number, 'description' => AttributeType::String, 'parentId' => AttributeType::Mixed, 'totalSteps' => AttributeType::Number, 'currentStep' => AttributeType::Number, 'status' => array(AttributeType::Enum, 'values' => array(TaskStatus::Pending, TaskStatus::Error, TaskStatus::Running), 'default' => TaskStatus::Pending)));
 }
 protected function defineAttributes()
 {
     return array_merge(parent::defineAttributes(), array('type' => AttributeType::String, 'url' => AttributeType::String, 'requestUrl' => AttributeType::String, 'title' => AttributeType::String, 'description' => AttributeType::String, 'authorName' => AttributeType::String, 'authorUrl' => AttributeType::String, 'providerName' => AttributeType::String, 'providerUrl' => AttributeType::String, 'cacheAge' => AttributeType::String, 'thumbnailUrl' => AttributeType::String, 'thumbnailWidth' => AttributeType::Number, 'thumbnailHeight' => AttributeType::Number, 'html' => AttributeType::String, 'safeHtml' => AttributeType::String, 'width' => AttributeType::Number, 'height' => AttributeType::Number));
 }