Issue #2041423 by yched: Rely on 'provider' instead of 'module' for Field plugin types.
parent
9dd98eaa6f
commit
11495979d0
|
@ -190,7 +190,7 @@ abstract class EntityStorageControllerBase implements EntityStorageControllerInt
|
|||
// of making LegacyConfigFieldItem implement PrepareCacheInterface.
|
||||
// @todo Remove once all core field types have been converted (see
|
||||
// http://drupal.org/node/2014671).
|
||||
|| (is_subclass_of($type_definition['class'], '\Drupal\field\Plugin\field\field_type\LegacyConfigFieldItem') && function_exists($type_definition['module'] . '_field_load'))) {
|
||||
|| (is_subclass_of($type_definition['class'], '\Drupal\field\Plugin\field\field_type\LegacyConfigFieldItem') && function_exists($type_definition['provider'] . '_field_load'))) {
|
||||
|
||||
// Call the prepareCache() method directly on each item
|
||||
// individually.
|
||||
|
@ -211,7 +211,7 @@ abstract class EntityStorageControllerBase implements EntityStorageControllerInt
|
|||
if (is_subclass_of($type_definition['class'], '\Drupal\Core\Entity\Field\PrepareCacheInterface')
|
||||
// @todo Remove once all core field types have been converted
|
||||
// (see http://drupal.org/node/2014671).
|
||||
|| (is_subclass_of($type_definition['class'], '\Drupal\field\Plugin\field\field_type\LegacyConfigFieldItem') && function_exists($type_definition['module'] . '_field_load'))) {
|
||||
|| (is_subclass_of($type_definition['class'], '\Drupal\field\Plugin\field\field_type\LegacyConfigFieldItem') && function_exists($type_definition['provider'] . '_field_load'))) {
|
||||
|
||||
// Create the items object.
|
||||
$items = isset($entity->{$field_name}[$langcode]) ? $entity->{$field_name}[$langcode] : array();
|
||||
|
|
|
@ -24,7 +24,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "datetime_default",
|
||||
* module = "datetime",
|
||||
* label = @Translation("Default"),
|
||||
* field_types = {
|
||||
* "datetime"
|
||||
|
|
|
@ -19,7 +19,6 @@ use Drupal\Core\Datetime\DrupalDateTime;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "datetime_plain",
|
||||
* module = "datetime",
|
||||
* label = @Translation("Plain"),
|
||||
* field_types = {
|
||||
* "datetime"
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "email_mailto",
|
||||
* module = "email",
|
||||
* label = @Translation("Email"),
|
||||
* field_types = {
|
||||
* "email"
|
||||
|
|
|
@ -19,7 +19,6 @@ use Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "entity_reference_entity_view",
|
||||
* module = "entity_reference",
|
||||
* label = @Translation("Rendered entity"),
|
||||
* description = @Translation("Display the referenced entities rendered by entity_view()."),
|
||||
* field_types = {
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "entity_reference_entity_id",
|
||||
* module = "entity_reference",
|
||||
* label = @Translation("Entity ID"),
|
||||
* description = @Translation("Display the ID of the referenced entities."),
|
||||
* field_types = {
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "entity_reference_label",
|
||||
* module = "entity_reference",
|
||||
* label = @Translation("Label"),
|
||||
* description = @Translation("Display the label of the referenced entities."),
|
||||
* field_types = {
|
||||
|
|
|
@ -442,8 +442,8 @@ function field_sync_field_status() {
|
|||
// Set fields with missing field type or storage modules to inactive.
|
||||
foreach ($fields as $uuid => &$field) {
|
||||
// Associate field types.
|
||||
if (isset($field_types[$field['type']]) && ($field['module'] != $field_types[$field['type']]['module'] || !$field['active'])) {
|
||||
$field['module'] = $field_types[$field['type']]['module'];
|
||||
if (isset($field_types[$field['type']]) && ($field['module'] != $field_types[$field['type']]['provider'] || !$field['active'])) {
|
||||
$field['module'] = $field_types[$field['type']]['provider'];
|
||||
$field['active'] = TRUE;
|
||||
$changed[$uuid] = $field;
|
||||
}
|
||||
|
|
|
@ -51,13 +51,6 @@ class FieldFormatter extends Plugin {
|
|||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* The name of the module providing the formatter.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $module;
|
||||
|
||||
/**
|
||||
* The name of the field formatter class.
|
||||
*
|
||||
|
|
|
@ -356,7 +356,7 @@ class Field extends ConfigEntityBase implements FieldInterface {
|
|||
if (!$field_type) {
|
||||
throw new FieldException(format_string('Attempt to create a field of unknown type %type.', array('%type' => $this->type)));
|
||||
}
|
||||
$this->module = $field_type['module'];
|
||||
$this->module = $field_type['provider'];
|
||||
$this->active = TRUE;
|
||||
|
||||
// Make sure all settings are present, so that a complete field
|
||||
|
|
|
@ -95,7 +95,7 @@ class ConfigEntityReferenceItemBase extends EntityReferenceItem implements Confi
|
|||
*/
|
||||
public static function schema(Field $field) {
|
||||
$definition = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field->type);
|
||||
$module = $definition['module'];
|
||||
$module = $definition['provider'];
|
||||
module_load_install($module);
|
||||
$callback = "{$module}_field_schema";
|
||||
if (function_exists($callback)) {
|
||||
|
@ -161,7 +161,7 @@ class ConfigEntityReferenceItemBase extends EntityReferenceItem implements Confi
|
|||
*/
|
||||
protected function getLegacyCallback($hook) {
|
||||
$definition = $this->getPluginDefinition();
|
||||
$module = $definition['module'];
|
||||
$module = $definition['provider'];
|
||||
$callback = "{$module}_field_{$hook}";
|
||||
if (function_exists($callback)) {
|
||||
return $callback;
|
||||
|
|
|
@ -64,7 +64,7 @@ class LegacyFieldTypeDiscoveryDecorator implements DiscoveryInterface {
|
|||
if (function_exists($function)) {
|
||||
foreach ($function() as $plugin_id => $definition) {
|
||||
$definition['id'] = $plugin_id;
|
||||
$definition['module'] = $module;
|
||||
$definition['provider'] = $module;
|
||||
$definition['list_class'] = '\Drupal\field\Plugin\field\field_type\LegacyConfigField';
|
||||
$definitions[$plugin_id] = $definition;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ class LegacyConfigField extends ConfigField {
|
|||
*/
|
||||
protected function legacyCallback($hook, $args = array()) {
|
||||
$definition = $this->getPluginDefinition();
|
||||
$module = $definition['module'];
|
||||
$module = $definition['provider'];
|
||||
$callback = "{$module}_field_{$hook}";
|
||||
if (function_exists($callback)) {
|
||||
$entity = $this->getParent();
|
||||
|
|
|
@ -31,7 +31,7 @@ abstract class LegacyConfigFieldItem extends ConfigFieldItemBase implements Prep
|
|||
*/
|
||||
public static function schema(Field $field) {
|
||||
$definition = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field->type);
|
||||
$module = $definition['module'];
|
||||
$module = $definition['provider'];
|
||||
module_load_install($module);
|
||||
$callback = "{$module}_field_schema";
|
||||
if (function_exists($callback)) {
|
||||
|
@ -118,7 +118,7 @@ abstract class LegacyConfigFieldItem extends ConfigFieldItemBase implements Prep
|
|||
*/
|
||||
protected function getLegacyCallback($hook) {
|
||||
$definition = $this->getPluginDefinition();
|
||||
$module = $definition['module'];
|
||||
$module = $definition['provider'];
|
||||
$callback = "{$module}_field_{$hook}";
|
||||
if (function_exists($callback)) {
|
||||
return $callback;
|
||||
|
|
|
@ -29,7 +29,7 @@ class FieldInfoTest extends FieldUnitTestBase {
|
|||
foreach ($field_type as $key => $val) {
|
||||
$this->assertEqual($info[$t_key][$key], $val, format_string('Field type %t_key key %key is %value', array('%t_key' => $t_key, '%key' => $key, '%value' => print_r($val, TRUE))));
|
||||
}
|
||||
$this->assertEqual($info[$t_key]['module'], 'field_test', 'Field type field_test module appears.');
|
||||
$this->assertEqual($info[$t_key]['provider'], 'field_test', 'Field type field_test module appears.');
|
||||
}
|
||||
|
||||
$storage_info = field_test_field_storage_info();
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "field_test_default",
|
||||
* module = "field_test",
|
||||
* label = @Translation("Default"),
|
||||
* description = @Translation("Default formatter"),
|
||||
* field_types = {
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\field\Plugin\Type\Formatter\FormatterBase;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "field_empty_test",
|
||||
* module = "field_test",
|
||||
* label = @Translation("Field empty test"),
|
||||
* field_types = {
|
||||
* "test_field",
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "field_test_multiple",
|
||||
* module = "field_test",
|
||||
* label = @Translation("Multiple"),
|
||||
* description = @Translation("Multiple formatter"),
|
||||
* field_types = {
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "field_test_with_prepare_view",
|
||||
* module = "field_test",
|
||||
* label = @Translation("With prepare step"),
|
||||
* description = @Translation("Tests prepareView() method"),
|
||||
* field_types = {
|
||||
|
|
|
@ -109,7 +109,7 @@ class FieldListController extends ConfigEntityListController {
|
|||
}
|
||||
|
||||
$field_type = $this->fieldTypes[$entity->getFieldType()];
|
||||
$row['data']['type'] = t('@type (module: @module)', array('@type' => $field_type['label'], '@module' => $field_type['module']));
|
||||
$row['data']['type'] = t('@type (module: @module)', array('@type' => $field_type['label'], '@module' => $field_type['provider']));
|
||||
|
||||
$usage = array();
|
||||
foreach($this->fieldInfo[$entity->id()]['bundles'] as $entity_type => $field_bundles) {
|
||||
|
|
|
@ -17,7 +17,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "file_default",
|
||||
* module = "file",
|
||||
* label = @Translation("Generic file"),
|
||||
* field_types = {
|
||||
* "file"
|
||||
|
|
|
@ -17,7 +17,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "file_rss_enclosure",
|
||||
* module = "file",
|
||||
* label = @Translation("RSS enclosure"),
|
||||
* field_types = {
|
||||
* "file"
|
||||
|
|
|
@ -17,7 +17,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "file_table",
|
||||
* module = "file",
|
||||
* label = @Translation("Table of files"),
|
||||
* field_types = {
|
||||
* "file"
|
||||
|
|
|
@ -17,7 +17,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "file_url_plain",
|
||||
* module = "file",
|
||||
* label = @Translation("URL to file"),
|
||||
* field_types = {
|
||||
* "file"
|
||||
|
|
|
@ -17,7 +17,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "image",
|
||||
* module = "image",
|
||||
* label = @Translation("Image"),
|
||||
* field_types = {
|
||||
* "image"
|
||||
|
|
|
@ -20,7 +20,6 @@ use Drupal\field\Plugin\Type\Formatter\FormatterBase;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "link",
|
||||
* module = "link",
|
||||
* label = @Translation("Link"),
|
||||
* field_types = {
|
||||
* "link"
|
||||
|
|
|
@ -16,14 +16,12 @@ use Drupal\field\Annotation\FieldFormatter;
|
|||
use Drupal\Core\Annotation\Translation;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\Field\FieldInterface;
|
||||
use Drupal\field\Plugin\Type\Formatter\FormatterBase;
|
||||
|
||||
/**
|
||||
* Plugin implementation of the 'link_separate' formatter.
|
||||
*
|
||||
* @FieldFormatter(
|
||||
* id = "link_separate",
|
||||
* module = "link",
|
||||
* label = @Translation("Separate link text and URL"),
|
||||
* field_types = {
|
||||
* "link"
|
||||
|
|
|
@ -23,7 +23,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "number_decimal",
|
||||
* module = "number",
|
||||
* label = @Translation("Default"),
|
||||
* field_types = {
|
||||
* "number_decimal",
|
||||
|
|
|
@ -23,7 +23,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "number_integer",
|
||||
* module = "number",
|
||||
* label = @Translation("Default"),
|
||||
* field_types = {
|
||||
* "number_integer"
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "number_unformatted",
|
||||
* module = "number",
|
||||
* label = @Translation("Unformatted"),
|
||||
* field_types = {
|
||||
* "number_integer",
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "list_default",
|
||||
* module = "options",
|
||||
* label = @Translation("Default"),
|
||||
* field_types = {
|
||||
* "list_integer",
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "list_key",
|
||||
* module = "options",
|
||||
* label = @Translation("Key"),
|
||||
* field_types = {
|
||||
* "list_integer",
|
||||
|
|
|
@ -116,7 +116,7 @@ abstract class OptionsWidgetBase extends WidgetBase {
|
|||
|
||||
// Get the list of options from the field type module, and sanitize them.
|
||||
$field_type_info = field_info_field_types($this->fieldDefinition->getFieldType());
|
||||
$module = $field_type_info['module'];
|
||||
$module = $field_type_info['provider'];
|
||||
$options = (array) $module_handler->invoke($module, 'options_list', array($this->fieldDefinition, $this->entity));
|
||||
|
||||
// Add an empty option if the widget needs one.
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\image\Plugin\field\formatter\ImageFormatterBase;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "picture",
|
||||
* module = "picture",
|
||||
* label = @Translation("Picture"),
|
||||
* field_types = {
|
||||
* "image",
|
||||
|
|
|
@ -20,7 +20,6 @@ use Drupal\entity_reference\Plugin\field\formatter\EntityReferenceFormatterBase;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "entity_reference_rss_category",
|
||||
* module = "taxonomy",
|
||||
* label = @Translation("RSS category"),
|
||||
* description = @Translation("Display reference to taxonomy term in RSS."),
|
||||
* field_types = {
|
||||
|
|
|
@ -19,7 +19,6 @@ use Drupal\taxonomy\Plugin\field\formatter\TaxonomyFormatterBase;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "taxonomy_term_reference_link",
|
||||
* module = "taxonomy",
|
||||
* label = @Translation("Link"),
|
||||
* field_types = {
|
||||
* "taxonomy_term_reference"
|
||||
|
|
|
@ -11,7 +11,6 @@ use Drupal\field\Annotation\FieldFormatter;
|
|||
use Drupal\Core\Annotation\Translation;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\Field\FieldInterface;
|
||||
use Drupal\field\Plugin\Type\Formatter\FormatterBase;
|
||||
use Drupal\taxonomy\Plugin\field\formatter\TaxonomyFormatterBase;
|
||||
|
||||
/**
|
||||
|
@ -19,7 +18,6 @@ use Drupal\taxonomy\Plugin\field\formatter\TaxonomyFormatterBase;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "taxonomy_term_reference_plain",
|
||||
* module = "taxonomy",
|
||||
* label = @Translation("Plain text"),
|
||||
* field_types = {
|
||||
* "taxonomy_term_reference"
|
||||
|
|
|
@ -11,7 +11,6 @@ use Drupal\field\Annotation\FieldFormatter;
|
|||
use Drupal\Core\Annotation\Translation;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\Field\FieldInterface;
|
||||
use Drupal\field\Plugin\Type\Formatter\FormatterBase;
|
||||
use Drupal\taxonomy\Plugin\field\formatter\TaxonomyFormatterBase;
|
||||
|
||||
/**
|
||||
|
@ -19,7 +18,6 @@ use Drupal\taxonomy\Plugin\field\formatter\TaxonomyFormatterBase;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "taxonomy_term_reference_rss_category",
|
||||
* module = "taxonomy",
|
||||
* label = @Translation("RSS category"),
|
||||
* field_types = {
|
||||
* "taxonomy_term_reference"
|
||||
|
|
|
@ -17,7 +17,6 @@ use Drupal\field\Plugin\Core\Entity\Field;
|
|||
*
|
||||
* @FieldType(
|
||||
* id = "telephone",
|
||||
* module = "telephone",
|
||||
* label = @Translation("Telephone number"),
|
||||
* description = @Translation("This field stores a telephone number in the database."),
|
||||
* default_widget = "telephone_default",
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "telephone_link",
|
||||
* module = "telephone",
|
||||
* label = @Translation("Telephone link"),
|
||||
* field_types = {
|
||||
* "telephone"
|
||||
|
|
|
@ -16,7 +16,6 @@ use Drupal\field\Plugin\Core\Entity\Field;
|
|||
*
|
||||
* @FieldType(
|
||||
* id = "text",
|
||||
* module = "text",
|
||||
* label = @Translation("Text"),
|
||||
* description = @Translation("This field stores varchar text in the database."),
|
||||
* settings = {
|
||||
|
|
|
@ -16,7 +16,6 @@ use Drupal\field\Plugin\Core\Entity\Field;
|
|||
*
|
||||
* @FieldType(
|
||||
* id = "text_long",
|
||||
* module = "text",
|
||||
* label = @Translation("Long text"),
|
||||
* description = @Translation("This field stores long text in the database."),
|
||||
* instance_settings = {
|
||||
|
|
|
@ -16,7 +16,6 @@ use Drupal\field\Plugin\Core\Entity\Field;
|
|||
*
|
||||
* @FieldType(
|
||||
* id = "text_with_summary",
|
||||
* module = "text",
|
||||
* label = @Translation("Long text and summary"),
|
||||
* description = @Translation("This field stores long text in the database along with optional summary text."),
|
||||
* instance_settings = {
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "text_default",
|
||||
* module = "text",
|
||||
* label = @Translation("Default"),
|
||||
* field_types = {
|
||||
* "text",
|
||||
|
|
|
@ -18,7 +18,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "text_plain",
|
||||
* module = "text",
|
||||
* label = @Translation("Plain text"),
|
||||
* field_types = {
|
||||
* "text",
|
||||
|
|
|
@ -15,7 +15,6 @@ use Drupal\Core\Annotation\Translation;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "text_summary_or_trimmed",
|
||||
* module = "text",
|
||||
* label = @Translation("Summary or trimmed"),
|
||||
* field_types = {
|
||||
* "text_with_summary"
|
||||
|
|
|
@ -23,7 +23,6 @@ use Drupal\Core\Entity\Field\FieldInterface;
|
|||
*
|
||||
* @FieldFormatter(
|
||||
* id = "text_trimmed",
|
||||
* module = "text",
|
||||
* label = @Translation("Trimmed"),
|
||||
* field_types = {
|
||||
* "text",
|
||||
|
|
Loading…
Reference in New Issue