Loading core/core.field_type_categories.yml 0 → 100644 +18 −0 Original line number Diff line number Diff line plain_text: label: 'Plain text' description: 'Text field that does not support markup.' weight: -50 number: label: 'Number' description: 'Field to store number. I.e. id, price, or quantity.' weight: -40 reference: label: 'Reference' description: 'Field to reference other content.' weight: -30 date_time: label: 'Date and time' description: 'Field to store date and time values.' weight: -10 general: class: \Drupal\Core\Field\FallbackFieldTypeCategory core/core.services.yml +5 −1 Original line number Diff line number Diff line Loading @@ -744,8 +744,12 @@ services: Drupal\Core\Block\BlockManagerInterface: '@plugin.manager.block' plugin.manager.field.field_type: class: Drupal\Core\Field\FieldTypePluginManager arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@typed_data_manager'] arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@typed_data_manager', '@plugin.manager.field.field_type_category'] Drupal\Core\Field\FieldTypePluginManagerInterface: '@plugin.manager.field.field_type' plugin.manager.field.field_type_category: class: \Drupal\Core\Field\FieldTypeCategoryManager arguments: [ '%app.root%', '@module_handler', '@cache.discovery' ] Drupal\Core\Field\FieldTypeCategoryManagerInterface: '@plugin.manager.field.field_type_category' plugin.manager.field.widget: class: Drupal\Core\Field\WidgetPluginManager arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@plugin.manager.field.field_type'] Loading core/lib/Drupal/Core/Field/FallbackFieldTypeCategory.php 0 → 100644 +22 −0 Original line number Diff line number Diff line <?php namespace Drupal\Core\Field; /** * Fallback plugin class for FieldTypeCategoryManager. */ class FallbackFieldTypeCategory extends FieldTypeCategory { /** * {@inheritdoc} */ public function __construct(array $configuration) { $plugin_definition = [ 'label' => $configuration['label'] ?? '', 'description' => $configuration['description'] ?? '', 'weight' => $configuration['weight'] ?? 0, ]; parent::__construct($configuration, $configuration['unique_identifier'], $plugin_definition); } } core/lib/Drupal/Core/Field/FieldTypeCategory.php 0 → 100644 +36 −0 Original line number Diff line number Diff line <?php namespace Drupal\Core\Field; use Drupal\Core\Plugin\PluginBase; use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Default object used for field_type_categories plugins. * * @see \Drupal\Core\Field\FieldTypeCategoryManager */ class FieldTypeCategory extends PluginBase implements FieldTypeCategoryInterface { /** * {@inheritdoc} */ public function getLabel(): TranslatableMarkup { return $this->pluginDefinition['label']; } /** * {@inheritdoc} */ public function getDescription(): TranslatableMarkup { return $this->pluginDefinition['description']; } /** * {@inheritdoc} */ public function getWeight(): int { return $this->pluginDefinition['weight']; } } core/lib/Drupal/Core/Field/FieldTypeCategoryInterface.php 0 → 100644 +36 −0 Original line number Diff line number Diff line <?php namespace Drupal\Core\Field; use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Provides an object that returns the category info about the field type. */ interface FieldTypeCategoryInterface { /** * Returns the field group label. * * @return \Drupal\Core\StringTranslation\TranslatableMarkup * The category label. */ public function getLabel(): TranslatableMarkup; /** * Returns the field group description. * * @return \Drupal\Core\StringTranslation\TranslatableMarkup * The category description. */ public function getDescription(): TranslatableMarkup; /** * Returns the field group weight. * * @return int * The weight. */ public function getWeight(): int; } Loading
core/core.field_type_categories.yml 0 → 100644 +18 −0 Original line number Diff line number Diff line plain_text: label: 'Plain text' description: 'Text field that does not support markup.' weight: -50 number: label: 'Number' description: 'Field to store number. I.e. id, price, or quantity.' weight: -40 reference: label: 'Reference' description: 'Field to reference other content.' weight: -30 date_time: label: 'Date and time' description: 'Field to store date and time values.' weight: -10 general: class: \Drupal\Core\Field\FallbackFieldTypeCategory
core/core.services.yml +5 −1 Original line number Diff line number Diff line Loading @@ -744,8 +744,12 @@ services: Drupal\Core\Block\BlockManagerInterface: '@plugin.manager.block' plugin.manager.field.field_type: class: Drupal\Core\Field\FieldTypePluginManager arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@typed_data_manager'] arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@typed_data_manager', '@plugin.manager.field.field_type_category'] Drupal\Core\Field\FieldTypePluginManagerInterface: '@plugin.manager.field.field_type' plugin.manager.field.field_type_category: class: \Drupal\Core\Field\FieldTypeCategoryManager arguments: [ '%app.root%', '@module_handler', '@cache.discovery' ] Drupal\Core\Field\FieldTypeCategoryManagerInterface: '@plugin.manager.field.field_type_category' plugin.manager.field.widget: class: Drupal\Core\Field\WidgetPluginManager arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@plugin.manager.field.field_type'] Loading
core/lib/Drupal/Core/Field/FallbackFieldTypeCategory.php 0 → 100644 +22 −0 Original line number Diff line number Diff line <?php namespace Drupal\Core\Field; /** * Fallback plugin class for FieldTypeCategoryManager. */ class FallbackFieldTypeCategory extends FieldTypeCategory { /** * {@inheritdoc} */ public function __construct(array $configuration) { $plugin_definition = [ 'label' => $configuration['label'] ?? '', 'description' => $configuration['description'] ?? '', 'weight' => $configuration['weight'] ?? 0, ]; parent::__construct($configuration, $configuration['unique_identifier'], $plugin_definition); } }
core/lib/Drupal/Core/Field/FieldTypeCategory.php 0 → 100644 +36 −0 Original line number Diff line number Diff line <?php namespace Drupal\Core\Field; use Drupal\Core\Plugin\PluginBase; use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Default object used for field_type_categories plugins. * * @see \Drupal\Core\Field\FieldTypeCategoryManager */ class FieldTypeCategory extends PluginBase implements FieldTypeCategoryInterface { /** * {@inheritdoc} */ public function getLabel(): TranslatableMarkup { return $this->pluginDefinition['label']; } /** * {@inheritdoc} */ public function getDescription(): TranslatableMarkup { return $this->pluginDefinition['description']; } /** * {@inheritdoc} */ public function getWeight(): int { return $this->pluginDefinition['weight']; } }
core/lib/Drupal/Core/Field/FieldTypeCategoryInterface.php 0 → 100644 +36 −0 Original line number Diff line number Diff line <?php namespace Drupal\Core\Field; use Drupal\Core\StringTranslation\TranslatableMarkup; /** * Provides an object that returns the category info about the field type. */ interface FieldTypeCategoryInterface { /** * Returns the field group label. * * @return \Drupal\Core\StringTranslation\TranslatableMarkup * The category label. */ public function getLabel(): TranslatableMarkup; /** * Returns the field group description. * * @return \Drupal\Core\StringTranslation\TranslatableMarkup * The category description. */ public function getDescription(): TranslatableMarkup; /** * Returns the field group weight. * * @return int * The weight. */ public function getWeight(): int; }