本文整理汇总了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');
}
}