0

I am trying to provide a default content type, entity form display, entity view display and a list (text) field on module installation. Installation errors out (though the module is installed) because of a plugin not found exception for "options_select" which is a core plugin.

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "options_select" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of /var/www/tx-sampling.zaner-bloser.com/webroot/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

This is caused by EntityViewBuilder not finding options_select in its object $definitions property, but why? options_select is a core plugin, and should be loaded? There is no dependency to add in config as the dependencies schema type does not have a "core" option.

This is probably due to something I am not understanding correctly with the YAML configuration I am providing given the following configuration in module_name/config/install:

config_fail/config/install/node.type.config_fail.yml:

langcode: en
status: true
dependencies:
  module:
    - menu_ui
    - config_fail
  enforced:
    module:
      - config_fail
third_party_settings:
  menu_ui:
    available_menus: {  }
    parent: ''
name: 'Config Fail'
type: config_fail
description: 'A content type installed by this module.'
help: ''
new_revision: true
preview_mode: 0
display_submitted: false

config_fail/config/install/field.storage.node.field_blah.yml:

    langcode: en
    status: true
    dependencies:
      module:
        - node
        - options
        - config_fail
      enforced:
        module:
          - config_fail
    id: node.field_blah
    field_name: field_blah
    entity_type: node
    type: list_string
    settings:
      allowed_values:
        -
          value: 'a'
          label: 'Option A'
        -
          value: 'b'
          label: 'Option B'
      allowed_values_function: ''
    module: options
    locked: true
    cardinality: 1
    translatable: true
    indexes: {  }
    persist_with_no_fields: false
    custom_storage: false

config_fail/config/install/field.field.node.config_fail.field_blah.yml:

langcode: en
status: true
dependencies:
  config:
    - field.storage.node.field_blah
    - node.type.config_fail
  module:
    - options
id: node.config_fail.field_blah
field_name: field_blah
entity_type: node
bundle: config_fail
label: 'Some Field'
description: 'Choose some option'
required: false
translatable: false
default_value: {  }
default_value_callback: ''
settings: {  }
field_type: list_string

config_fail/config/install/core.entity_form_display.node.config_fail.default.yml

langcode: en
status: true
dependencies:
  config:
    - field.field.node.config_fail.field_blah
    - node.type.config_fail
  module:
    - path
    - options
id: node.config_fail.default
targetEntityType: node
bundle: config_fail
mode: default
content:
  created:
    type: datetime_timestamp
    weight: 8
    region: content
    settings: {  }
    third_party_settings: {  }
  field_blah:
    weight: 0
    settings: {  }
    third_party_settings: {  }
    type: options_select
    region: content
  path:
    type: path
    weight: 10
    region: content
    settings: {  }
    third_party_settings: {  }
  promote:
    type: boolean_checkbox
    weight: 9
    region: content
    settings:
      display_label: true
    third_party_settings: {  }
  status:
    type: boolean_checkbox
    settings:
      display_label: true
    weight: 6
    region: content
    third_party_settings: {  }
  sticky:
    type: boolean_checkbox
    settings:
      display_label: true
    weight: 11
    region: content
    third_party_settings: {  }
  title:
    type: string_textfield
    weight: 0
    region: content
    settings:
      size: 60
      placeholder: ''
    third_party_settings: {  }
  uid:
    type: entity_reference_autocomplete
    weight: 7
    region: content
    settings:
      match_operator: CONTAINS
      size: 60
      placeholder: ''
    third_party_settings: {  }
hidden: {  }

config_fail/config/install/core.entity_view_display.node.config_fail.default.yml

langcode: en
status: true
dependencies:
  config:
    - field.field.node.config_fail.field_blah
    - node.type.config_fail
  module:
    - path
    - options
id: node.config_fail.default
targetEntityType: node
bundle: config_fail
mode: default
content:
  created:
    type: datetime_timestamp
    weight: 8
    region: content
    settings: {  }
    third_party_settings: {  }
  field_blah:
    weight: 0
    settings: {  }
    third_party_settings: {  }
    type: options_select
    region: content
  path:
    type: path
    weight: 10
    region: content
    settings: {  }
    third_party_settings: {  }
  promote:
    type: boolean_checkbox
    weight: 9
    region: content
    settings:
      display_label: true
    third_party_settings: {  }
  status:
    type: boolean_checkbox
    settings:
      display_label: true
    weight: 6
    region: content
    third_party_settings: {  }
  sticky:
    type: boolean_checkbox
    settings:
      display_label: true
    weight: 11
    region: content
    third_party_settings: {  }
  title:
    type: string_textfield
    weight: 0
    region: content
    settings:
      size: 60
      placeholder: ''
    third_party_settings: {  }
  uid:
    type: entity_reference_autocomplete
    weight: 7
    region: content
    settings:
      match_operator: CONTAINS
      size: 60
      placeholder: ''
    third_party_settings: {  }
hidden: {  }

config_fail/config_fail.info.yml:

name: 'Config Install fail'
type: module
core: 8.x
dependencies:
  - options
2

Unfortunately the error message doesn't say which plugin type is missing.

But I think it is a field formatter plugin. You install a field type list_string:

 * @FieldType(
 *   id = "list_string",
 *   label = @Translation("List (text)"),
 *   description = @Translation("This field stores text values from a list of allowed 'value => label' pairs, i.e. 'US States': IL => Illinois, IA => Iowa, IN => Indiana."),
 *   category = @Translation("Text"),
 *   default_widget = "options_select",
 *   default_formatter = "list_default",
 * )
 */

The widget options_select is correct for the form mode, but not for the view mode. Here you can use the field formatter list_default.

  • I think I must have copy and pasted from a config export incorrectly. Thanks. – mradcliffe Dec 18 '17 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.