getDefinition() public method

public getDefinition ( Craft\FieldModel $field, $includeContext ) : array
$field Craft\FieldModel
$includeContext
return array
示例#1
0
 /**
  * @param FieldModel $field
  * @param $includeContext
  *
  * @return array
  */
 public function getDefinition(FieldModel $field, $includeContext)
 {
     $definition = parent::getDefinition($field, $includeContext);
     $settings = $definition['settings'];
     $defaultUploadLocationSourceId = $settings['defaultUploadLocationSource'];
     $defaultUploadLocationSource = Craft::app()->schematic_assetSources->getSourceTypeById($defaultUploadLocationSourceId);
     $settings['defaultUploadLocationSource'] = $defaultUploadLocationSource ? $defaultUploadLocationSource->handle : '';
     $singleUploadLocationSourceId = $settings['singleUploadLocationSource'];
     $singleUploadLocationSource = Craft::app()->schematic_assetSources->getSourceTypeById($singleUploadLocationSourceId);
     $settings['singleUploadLocationSource'] = $singleUploadLocationSource ? $singleUploadLocationSource->handle : '';
     $definition['settings'] = $settings;
     return $definition;
 }
示例#2
0
 /**
  * @param FieldModel $field
  * @param $includeContext
  *
  * @return array
  */
 public function getDefinition(FieldModel $field, $includeContext)
 {
     $definition = parent::getDefinition($field, $includeContext);
     $definition['blockTypes'] = $this->getBlockTypeDefinitions($field);
     return $definition;
 }