NerdsAndCompany\Schematic\Models\AssetsField::getDefinition PHP Méthode

getDefinition() public méthode

public getDefinition ( Craft\FieldModel $field, $includeContext ) : array
$field Craft\FieldModel
$includeContext
Résultat array
    public function getDefinition(FieldModel $field, $includeContext)
    {
        $definition = parent::getDefinition($field, $includeContext);
        $settings = $definition['settings'];
        if ($settings && array_key_exists('defaultUploadLocationSource', $settings)) {
            $defaultUploadLocationSourceId = $settings['defaultUploadLocationSource'];
            $defaultUploadLocationSource = Craft::app()->schematic_assetSources->getSourceTypeById($defaultUploadLocationSourceId);
            $settings['defaultUploadLocationSource'] = $defaultUploadLocationSource ? $defaultUploadLocationSource->handle : '';
        }
        if ($settings && array_key_exists('singleUploadLocationSource', $settings)) {
            $singleUploadLocationSourceId = $settings['singleUploadLocationSource'];
            $singleUploadLocationSource = Craft::app()->schematic_assetSources->getSourceTypeById($singleUploadLocationSourceId);
            $settings['singleUploadLocationSource'] = $singleUploadLocationSource ? $singleUploadLocationSource->handle : '';
        }
        $definition['settings'] = $settings;
        return $definition;
    }