本文整理匯總了PHP中Drupal\field\Entity\FieldStorageConfig::set方法的典型用法代碼示例。如果您正苦於以下問題:PHP FieldStorageConfig::set方法的具體用法?PHP FieldStorageConfig::set怎麽用?PHP FieldStorageConfig::set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Drupal\field\Entity\FieldStorageConfig
的用法示例。
在下文中一共展示了FieldStorageConfig::set方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: init
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
{
parent::init($view, $display, $options);
$this->definition['field_name'] = $this->definition['entity field'];
$field_storage = $this->getFieldStorageDefinition();
// We may have not a valid workflow field.
if (FALSE && $field_storage) {
// Set valueOptions here so getValueOptions() will just return it.
$this->valueOptions = options_allowed_values($field_storage);
// $this->valueOptions = workflow_state_allowed_values($field_storage);
} else {
// TODO D8. This is a hack. It doesn't work.
// The default options_allowed_values only reads field_name. Repair that.
$field_name = $this->definition['entity field'];
$field_storage = new FieldStorageConfig(['field_name' => $field_name, 'type' => 'testtype', 'entity_type' => $options['entity_type']]);
$field_storage->set('allowed_values_function', 'workflow_state_allowed_values');
$wid = '';
// Set valueOptions here so getValueOptions() will just return it.
// $this->valueOptions = options_allowed_values($field_storage);
// $this->valueOptions = workflow_state_allowed_values($field_storage);
$this->valueOptions = workflow_get_workflow_state_names($wid, $options['group_info']['widget'] == 'select');
}
}