当前位置: 首页>>代码示例>>PHP>>正文


PHP FieldTypePluginManagerInterface::getDefinitions方法代码示例

本文整理汇总了PHP中Drupal\Core\Field\FieldTypePluginManagerInterface::getDefinitions方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldTypePluginManagerInterface::getDefinitions方法的具体用法?PHP FieldTypePluginManagerInterface::getDefinitions怎么用?PHP FieldTypePluginManagerInterface::getDefinitions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Field\FieldTypePluginManagerInterface的用法示例。


在下文中一共展示了FieldTypePluginManagerInterface::getDefinitions方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructs a new FieldStorageConfigListBuilder object.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  *   The entity type definition.
  * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
  *   The entity manager.
  * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager
  *   The 'field type' plugin manager.
  */
 public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, EntityTypeBundleInfoInterface $bundle_info_service)
 {
     parent::__construct($entity_type, $entity_manager->getStorage($entity_type->id()));
     $this->entityManager = $entity_manager;
     $this->bundles = $bundle_info_service->getAllBundleInfo();
     $this->fieldTypeManager = $field_type_manager;
     $this->fieldTypes = $this->fieldTypeManager->getDefinitions();
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:18,代码来源:FieldStorageConfigListBuilder.php

示例2: __construct

 /**
  * Constructs a new FieldStorageConfigListBuilder object.
  *
  * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
  *   The entity type definition.
  * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
  *   The entity manager.
  * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager
  *   The 'field type' plugin manager.
  */
 public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager)
 {
     parent::__construct($entity_type, $entity_manager->getStorage($entity_type->id()));
     $this->entityManager = $entity_manager;
     $this->bundles = entity_get_bundles();
     $this->fieldTypeManager = $field_type_manager;
     $this->fieldTypes = $this->fieldTypeManager->getDefinitions();
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:18,代码来源:FieldStorageConfigListBuilder.php

示例3: getDerivativeDefinitions

 /**
  * {@inheritdoc}
  */
 public function getDerivativeDefinitions($base_plugin_definition)
 {
     foreach ($this->fieldTypePluginManager->getDefinitions() as $plugin_id => $definition) {
         $definition['definition_class'] = '\\Drupal\\Core\\Field\\TypedData\\FieldItemDataDefinition';
         $definition['list_definition_class'] = '\\Drupal\\Core\\Field\\FieldDefinition';
         $this->derivatives[$plugin_id] = $definition;
     }
     return $this->derivatives;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:12,代码来源:FieldItemDeriver.php

示例4: getExistingFieldOptions

 /**
  * Returns an array of existing fields to be added to a bundle.
  *
  * @return array
  *   An array of existing fields keyed by field name.
  */
 protected function getExistingFieldOptions()
 {
     $options = array();
     // Collect candidate field instances: all instances of fields for this
     // entity type that are not already present in the current bundle.
     $field_map = \Drupal::entityManager()->getFieldMap();
     $instance_ids = array();
     if (!empty($field_map[$this->entity_type])) {
         foreach ($field_map[$this->entity_type] as $field_name => $data) {
             if (!in_array($this->bundle, $data['bundles'])) {
                 $bundle = reset($data['bundles']);
                 $instance_ids[] = $this->entity_type . '.' . $bundle . '.' . $field_name;
             }
         }
     }
     // Load the instances and build the list of options.
     if ($instance_ids) {
         $field_types = $this->fieldTypeManager->getDefinitions();
         $instances = $this->entityManager->getStorage('field_instance_config')->loadMultiple($instance_ids);
         foreach ($instances as $instance) {
             // Do not show:
             // - locked fields,
             // - fields that should not be added via user interface.
             $field_type = $instance->getType();
             $field_storage = $instance->getFieldStorageDefinition();
             if (empty($field_storage->locked) && empty($field_types[$field_type]['no_ui'])) {
                 $options[$instance->getName()] = array('type' => $field_type, 'type_label' => $field_types[$field_type]['label'], 'field' => $instance->getName(), 'label' => $instance->getLabel());
             }
         }
     }
     return $options;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:38,代码来源:FieldOverview.php

示例5: __construct

 /**
  * Constructs a new DisplayOverviewBase.
  *
  * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
  *   The entity manager.
  * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager
  *   The field type manager.
  * @param \Drupal\Component\Plugin\PluginManagerBase $plugin_manager
  *   The widget or formatter plugin manager.
  * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
  *   The configuration factory.
  */
 public function __construct(EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, PluginManagerBase $plugin_manager, ConfigFactoryInterface $config_factory)
 {
     parent::__construct($entity_manager);
     $this->fieldTypes = $field_type_manager->getDefinitions();
     $this->pluginManager = $plugin_manager;
     $this->configFactory = $config_factory;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:19,代码来源:DisplayOverviewBase.php

示例6: buildRow

 /**
  * {@inheritdoc}
  */
 public function buildRow(EntityInterface $field_config)
 {
     /** @var \Drupal\field\FieldConfigInterface $field_config */
     $field_storage = $field_config->getFieldStorageDefinition();
     $route_parameters = array('field_config' => $field_config->id()) + FieldUI::getRouteBundleParameter($this->entityManager->getDefinition($this->targetEntityTypeId), $this->targetBundle);
     $row = array('id' => Html::getClass($field_config->getName()), 'data' => array('label' => $field_config->getLabel(), 'field_name' => $field_config->getName(), 'field_type' => array('data' => array('#type' => 'link', '#title' => $this->fieldTypeManager->getDefinitions()[$field_storage->getType()]['label'], '#url' => Url::fromRoute("entity.field_config.{$this->targetEntityTypeId}_storage_edit_form", $route_parameters), '#options' => array('attributes' => array('title' => $this->t('Edit field settings.')))))));
     // Add the operations.
     $row['data'] = $row['data'] + parent::buildRow($field_config);
     if ($field_storage->isLocked()) {
         $row['data']['operations'] = array('data' => array('#markup' => $this->t('Locked')));
         $row['class'][] = 'menu-disabled';
     }
     return $row;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:17,代码来源:FieldConfigListBuilder.php

示例7: getExistingFieldStorageOptions

 /**
  * Returns an array of existing field storages that can be added to a bundle.
  *
  * @return array
  *   An array of existing field storages keyed by name.
  */
 protected function getExistingFieldStorageOptions()
 {
     $options = array();
     // Load the field_storages and build the list of options.
     $field_types = $this->fieldTypePluginManager->getDefinitions();
     foreach ($this->entityManager->getFieldStorageDefinitions($this->entityTypeId) as $field_name => $field_storage) {
         // Do not show:
         // - non-configurable field storages,
         // - locked field storages,
         // - field storages that should not be added via user interface,
         // - field storages that already have a field in the bundle.
         $field_type = $field_storage->getType();
         if ($field_storage instanceof FieldStorageConfigInterface && !$field_storage->isLocked() && empty($field_types[$field_type]['no_ui']) && !in_array($this->bundle, $field_storage->getBundles(), TRUE)) {
             $options[$field_name] = $this->t('@type: @field', array('@type' => $field_types[$field_type]['label'], '@field' => $field_name));
         }
     }
     asort($options);
     return $options;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:25,代码来源:FieldStorageAddForm.php

示例8: getOptions

 /**
  * Returns an array of widget type options for a field type.
  *
  * @param string|null $field_type
  *   (optional) The name of a field type, or NULL to retrieve all widget
  *   options. Defaults to NULL.
  *
  * @return array
  *   If no field type is provided, returns a nested array of all widget types,
  *   keyed by field type human name.
  */
 public function getOptions($field_type = NULL)
 {
     if (!isset($this->widgetOptions)) {
         $options = array();
         $field_types = $this->fieldTypeManager->getDefinitions();
         $widget_types = $this->getDefinitions();
         uasort($widget_types, array('Drupal\\Component\\Utility\\SortArray', 'sortByWeightElement'));
         foreach ($widget_types as $name => $widget_type) {
             foreach ($widget_type['field_types'] as $widget_field_type) {
                 // Check that the field type exists.
                 if (isset($field_types[$widget_field_type])) {
                     $options[$widget_field_type][$name] = $widget_type['label'];
                 }
             }
         }
         $this->widgetOptions = $options;
     }
     if (isset($field_type)) {
         return !empty($this->widgetOptions[$field_type]) ? $this->widgetOptions[$field_type] : array();
     }
     return $this->widgetOptions;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:33,代码来源:WidgetPluginManager.php

示例9: __construct

 /**
  * Constructs a new EntityDisplayFormBase.
  *
  * @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager
  *   The field type manager.
  * @param \Drupal\Component\Plugin\PluginManagerBase $plugin_manager
  *   The widget or formatter plugin manager.
  */
 public function __construct(FieldTypePluginManagerInterface $field_type_manager, PluginManagerBase $plugin_manager)
 {
     $this->fieldTypes = $field_type_manager->getDefinitions();
     $this->pluginManager = $plugin_manager;
 }
开发者ID:Greg-Boggs,项目名称:electric-dev,代码行数:13,代码来源:EntityDisplayFormBase.php

示例10: getFieldTypeLabel

 /**
  * Returns the label for a specified field type.
  *
  * @param string $field_type
  *   The field type.
  *
  * @return string
  *   The field type label.
  */
 protected function getFieldTypeLabel($field_type)
 {
     return $this->fieldTypeManager->getDefinitions()[$field_type]['label'];
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:13,代码来源:FieldUninstallValidator.php


注:本文中的Drupal\Core\Field\FieldTypePluginManagerInterface::getDefinitions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。