Fix duplicate key 'default_value' for 'impressed card' pattern

Created on 18 July 2023, over 1 year ago
Updated 10 September 2023, about 1 year ago

Problem/Motivation

Facing the following issue after the update

The website encountered an unexpected error. Please try again later.

Drupal\Component\Serialization\Exception\InvalidDataTypeException: Duplicate key "default_value" detected at line 48 (near "default_value: 'top'"). in Drupal\Component\Serialization\YamlSymfony::decode() (line 40 of core/lib/Drupal/Component/Serialization/YamlSymfony.php).
Symfony\Component\Yaml\Parser->parseBlock(40, 'type: 'select'
label: 'Media position'
default_value: ''
options:
  '': '- none -'
  top: 'Top'
  bottom: 'Bottom'
default_value: 'top'', 2) (Line: 320)
Symfony\Component\Yaml\Parser->doParse(Array, 2) (Line: 525)
Symfony\Component\Yaml\Parser->parseBlock(16, 'style_size:
  type: 'select'
  label: Card style size
  default_value: ''
  options:
    '': '- none -'
    xsmall: 'X-small'
    small: 'Small'
    medium: 'Medium'
    large: 'Large'
    xlarge: 'X-large'
card_border:
  type: 'switcher'
  label: Card Boarder
  default_value: true
equal_height:
  type: 'switcher'
  label: Equal height
  default_value: true
anchor_all:
  type: 'switcher'
  label: Anchor All
  default_value: false
media_position:
  type: 'select'
  label: 'Media position'
  default_value: ''
  options:
    '': '- none -'
    top: 'Top'
    bottom: 'Bottom'
  default_value: 'top'
additional_attributes:
  type: 'group'
  label: 'Additional attributes'
  group_type: 'details'
utility_classes:
  type: 'utility_classes'
  label: 'Utility classes'
  description: 'Use to add extra Bootstrap utility classes or custom CSS classes over component. E.g. w-75 mb-3'
  default_value: { }
  group: 'additional_attributes'
card_attributes:
  type: 'attributes'
  label: 'Card attributes'
  group: 'additional_attributes'
content_attributes:
  type: 'attributes'
  label: 'Content attributes'
  group: 'additional_attributes'
', 2) (Line: 320)
Symfony\Component\Yaml\Parser->doParse(Array, 2) (Line: 525)
Symfony\Component\Yaml\Parser->parseBlock(1, 'use: 'varbase_components:card-impressed'
label: 'Impressed Card'
description: Impressed card component description.
fields:
  media:
    type: media
    label: Media
    description: 'Media description.'
    preview: 'Card Media region'
  content:
    type: 'textfield'
    label: 'Content'
    description: 'Content description.'
    preview: 'Card Content'
settings:
  style_size:
    type: 'select'
    label: Card style size
    default_value: ''
    options:
      '': '- none -'
      xsmall: 'X-small'
      small: 'Small'
      medium: 'Medium'
      large: 'Large'
      xlarge: 'X-large'
  card_border:
    type: 'switcher'
    label: Card Boarder
    default_value: true
  equal_height:
    type: 'switcher'
    label: Equal height
    default_value: true
  anchor_all:
    type: 'switcher'
    label: Anchor All
    default_value: false
  media_position:
    type: 'select'
    label: 'Media position'
    default_value: ''
    options:
      '': '- none -'
      top: 'Top'
      bottom: 'Bottom'
    default_value: 'top'
  additional_attributes:
    type: 'group'
    label: 'Additional attributes'
    group_type: 'details'
  utility_classes:
    type: 'utility_classes'
    label: 'Utility classes'
    description: 'Use to add extra Bootstrap utility classes or custom CSS classes over component. E.g. w-75 mb-3'
    default_value: { }
    group: 'additional_attributes'
  card_attributes:
    type: 'attributes'
    label: 'Card attributes'
    group: 'additional_attributes'
  content_attributes:
    type: 'attributes'
    label: 'Content attributes'
    group: 'additional_attributes'
', 2) (Line: 320)
Symfony\Component\Yaml\Parser->doParse('card_impressed:
  use: 'varbase_components:card-impressed'
  label: 'Impressed Card'
  description: Impressed card component description.
  fields:
    media:
      type: media
      label: Media
      description: 'Media description.'
      preview: 'Card Media region'
    content:
      type: 'textfield'
      label: 'Content'
      description: 'Content description.'
      preview: 'Card Content'
  settings:
    style_size:
      type: 'select'
      label: Card style size
      default_value: ''
      options:
        '': '- none -'
        xsmall: 'X-small'
        small: 'Small'
        medium: 'Medium'
        large: 'Large'
        xlarge: 'X-large'
    card_border:
      type: 'switcher'
      label: Card Boarder
      default_value: true
    equal_height:
      type: 'switcher'
      label: Equal height
      default_value: true
    anchor_all:
      type: 'switcher'
      label: Anchor All
      default_value: false
    media_position:
      type: 'select'
      label: 'Media position'
      default_value: ''
      options:
        '': '- none -'
        top: 'Top'
        bottom: 'Bottom'
      default_value: 'top'
    additional_attributes:
      type: 'group'
      label: 'Additional attributes'
      group_type: 'details'
    utility_classes:
      type: 'utility_classes'
      label: 'Utility classes'
      description: 'Use to add extra Bootstrap utility classes or custom CSS classes over component. E.g. w-75 mb-3'
      default_value: { }
      group: 'additional_attributes'
    card_attributes:
      type: 'attributes'
      label: 'Card attributes'
      group: 'additional_attributes'
    content_attributes:
      type: 'attributes'
      label: 'Content attributes'
      group: 'additional_attributes'
', 2) (Line: 86)
Symfony\Component\Yaml\Parser->parse('card_impressed:
  use: 'varbase_components:card-impressed'
  label: 'Impressed Card'
  description: Impressed card component description.
  fields:
    media:
      type: media
      label: Media
      description: 'Media description.'
      preview: 'Card Media region'
    content:
      type: 'textfield'
      label: 'Content'
      description: 'Content description.'
      preview: 'Card Content'
  settings:
    style_size:
      type: 'select'
      label: Card style size
      default_value: ''
      options:
        '': '- none -'
        xsmall: 'X-small'
        small: 'Small'
        medium: 'Medium'
        large: 'Large'
        xlarge: 'X-large'
    card_border:
      type: 'switcher'
      label: Card Boarder
      default_value: true
    equal_height:
      type: 'switcher'
      label: Equal height
      default_value: true
    anchor_all:
      type: 'switcher'
      label: Anchor All
      default_value: false
    media_position:
      type: 'select'
      label: 'Media position'
      default_value: ''
      options:
        '': '- none -'
        top: 'Top'
        bottom: 'Bottom'
      default_value: 'top'
    additional_attributes:
      type: 'group'
      label: 'Additional attributes'
      group_type: 'details'
    utility_classes:
      type: 'utility_classes'
      label: 'Utility classes'
      description: 'Use to add extra Bootstrap utility classes or custom CSS classes over component. E.g. w-75 mb-3'
      default_value: { }
      group: 'additional_attributes'
    card_attributes:
      type: 'attributes'
      label: 'Card attributes'
      group: 'additional_attributes'
    content_attributes:
      type: 'attributes'
      label: 'Content attributes'
      group: 'additional_attributes'
', 2) (Line: 37)
Drupal\Component\Serialization\YamlSymfony::decode('card_impressed:
  use: 'varbase_components:card-impressed'
  label: 'Impressed Card'
  description: Impressed card component description.
  fields:
    media:
      type: media
      label: Media
      description: 'Media description.'
      preview: 'Card Media region'
    content:
      type: 'textfield'
      label: 'Content'
      description: 'Content description.'
      preview: 'Card Content'
  settings:
    style_size:
      type: 'select'
      label: Card style size
      default_value: ''
      options:
        '': '- none -'
        xsmall: 'X-small'
        small: 'Small'
        medium: 'Medium'
        large: 'Large'
        xlarge: 'X-large'
    card_border:
      type: 'switcher'
      label: Card Boarder
      default_value: true
    equal_height:
      type: 'switcher'
      label: Equal height
      default_value: true
    anchor_all:
      type: 'switcher'
      label: Anchor All
      default_value: false
    media_position:
      type: 'select'
      label: 'Media position'
      default_value: ''
      options:
        '': '- none -'
        top: 'Top'
        bottom: 'Bottom'
      default_value: 'top'
    additional_attributes:
      type: 'group'
      label: 'Additional attributes'
      group_type: 'details'
    utility_classes:
      type: 'utility_classes'
      label: 'Utility classes'
      description: 'Use to add extra Bootstrap utility classes or custom CSS classes over component. E.g. w-75 mb-3'
      default_value: { }
      group: 'additional_attributes'
    card_attributes:
      type: 'attributes'
      label: 'Card attributes'
      group: 'additional_attributes'
    content_attributes:
      type: 'attributes'
      label: 'Content attributes'
      group: 'additional_attributes'
') (Line: 35)
Drupal\Component\Serialization\Yaml::decode('card_impressed:
  use: 'varbase_components:card-impressed'
  label: 'Impressed Card'
  description: Impressed card component description.
  fields:
    media:
      type: media
      label: Media
      description: 'Media description.'
      preview: 'Card Media region'
    content:
      type: 'textfield'
      label: 'Content'
      description: 'Content description.'
      preview: 'Card Content'
  settings:
    style_size:
      type: 'select'
      label: Card style size
      default_value: ''
      options:
        '': '- none -'
        xsmall: 'X-small'
        small: 'Small'
        medium: 'Medium'
        large: 'Large'
        xlarge: 'X-large'
    card_border:
      type: 'switcher'
      label: Card Boarder
      default_value: true
    equal_height:
      type: 'switcher'
      label: Equal height
      default_value: true
    anchor_all:
      type: 'switcher'
      label: Anchor All
      default_value: false
    media_position:
      type: 'select'
      label: 'Media position'
      default_value: ''
      options:
        '': '- none -'
        top: 'Top'
        bottom: 'Bottom'
      default_value: 'top'
    additional_attributes:
      type: 'group'
      label: 'Additional attributes'
      group_type: 'details'
    utility_classes:
      type: 'utility_classes'
      label: 'Utility classes'
      description: 'Use to add extra Bootstrap utility classes or custom CSS classes over component. E.g. w-75 mb-3'
      default_value: { }
      group: 'additional_attributes'
    card_attributes:
      type: 'attributes'
      label: 'Card attributes'
      group: 'additional_attributes'
    content_attributes:
      type: 'attributes'
      label: 'Content attributes'
      group: 'additional_attributes'
') (Line: 140)
Drupal\ui_patterns\Plugin\Deriver\YamlPatternDeriver->getPatterns() (Line: 61)
Drupal\ui_patterns\Plugin\Deriver\AbstractPatternsDeriver->getDerivativeDefinitions(Array) (Line: 101)
Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array) (Line: 87)
Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions() (Line: 291)
Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() (Line: 158)
Drupal\ui_patterns\UiPatternsManager->getDefinitions() (Line: 52)
Drupal\ui_patterns\UiPatterns::getPatternDefinitions() (Line: 23)
ui_patterns_layouts_layout_alter(Array, NULL, NULL) (Line: 545)
Drupal\Core\Extension\ModuleHandler->alter('layout', Array) (Line: 340)
Drupal\Core\Plugin\DefaultPluginManager->alterDefinitions(Array) (Line: 295)
Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() (Line: 181)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 168)
Drupal\Core\Layout\LayoutPluginManager->getThemeImplementations() (Line: 28)
layout_discovery_theme(Array, 'module', 'layout_discovery', 'core/modules/layout_discovery') (Line: 455)
Drupal\Core\Theme\Registry->processExtension(Array, 'layout_discovery', 'module', 'layout_discovery', 'core/modules/layout_discovery') (Line: 348)
Drupal\Core\Theme\Registry->Drupal\Core\Theme\{closure}(Object, 'layout_discovery') (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('theme', Object) (Line: 349)
Drupal\Core\Theme\Registry->build() (Line: 247)
Drupal\Core\Theme\Registry->get() (Line: 88)
Drupal\Core\Utility\ThemeRegistry->initializeRegistry() (Line: 69)
Drupal\Core\Utility\ThemeRegistry->__construct('theme_registry:runtime:vartheme_claro', Object, Object, Array, 1) (Line: 267)
Drupal\Core\Theme\Registry->getRuntime() (Line: 141)
Drupal\Core\Theme\ThemeManager->render('webform_element_more', Array) (Line: 436)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 204)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 160)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 161)
Drupal\Core\Render\Renderer->renderPlain(Array) (Line: 1167)
_webform_token_render_more(Object, 'Omit the '?' to output all values. Output all values as HTML using [webform_submission:values:html].To output individual elements, replace the '?' with…<ul><li>element_key</li><li>element_key:format</li><li>element_key:raw</li><li>element_key:format:items</li><li>element_key:delta</li><li>element_key:sub_element_key</li><li>element_key:delta:sub_element_key</li><li>element_key:sub_element_key:format</li><li>element_key:delta:sub_element_key:format</li><li>element_key:delta:format</li><li>element_key:delta:format:html</li><li>element_key:entity:*</li><li>element_key:delta:entity:*</li><li>element_key:delta:entity:field_name:*</li><li>element_key:sub_element_key:entity:*</li><li>element_key:sub_element_key:entity:field_name:*</li><li>element_key:delta:sub_element_key:entity:*</li><li>element_key:checked:option_value</li><li>element_key:selected:option_value</li></ul>All items after the 'element_key' are optional.The 'delta' is the numeric index for specific valueThe 'sub_element_key' is a composite element's sub element key.The 'checked'  or 'selected' looks to see if an 'option_value' is checked or selected for an options element (select, checkboxes, or radios)The 'option_value' is options value for an options element (select, checkboxes, or radios).The 'format' can be 'value', 'raw', or custom format specifically associated with the elementThe 'items' can be 'comma', 'semicolon', 'and', 'ol', 'ul', or custom delimiterThe 'entity:*' applies to the referenced entityAdd 'html' at the end of the token to return HTML markup instead of plain text.For example, to display the Contact webform's 'Subject' element's value you would use the [webform_submission:values:subject] token.') (Line: 257)
webform_token_info()
call_user_func_array(Object, Array) (Line: 409)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'webform') (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('token_info', Object) (Line: 416)
Drupal\Core\Extension\ModuleHandler->invokeAll('token_info') (Line: 40)
Drupal\token\Token->getInfo() (Line: 94)
token_get_token_problems() (Line: 16)
token_requirements('runtime')
call_user_func_array(Object, Array) (Line: 409)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'token') (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('requirements', Object) (Line: 416)
Drupal\Core\Extension\ModuleHandler->invokeAll('requirements', Array) (Line: 109)
Drupal\system\SystemManager->listRequirements() (Line: 93)
Drupal\system\SystemManager->checkRequirements() (Line: 120)
Drupal\system\Controller\SystemController->overview('system.admin_config')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 53)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Proposed resolution

Remove the duplicate default value for media position
keep it as:

    media_position:
      type: 'select'
      label: 'Media position'
      default_value: ''
      options:
        '': '- none -'
        top: 'Top'
        bottom: 'Bottom'

Remaining tasks

  • βœ… File an issue about this project
  • βœ… Addition/Change/Update/Fix to this project
  • βœ… Testing to ensure no regression
  • βž– Automated unit/functional testing coverage
  • βž– Developer Documentation support on feature change/addition
  • βž– User Guide Documentation support on feature change/addition
  • βœ… Accessibility and Readability
  • βœ… Code review from 1 Varbase core team member
  • βœ… Full testing and approval
  • βœ… Credit contributors
  • βœ… Review with the product owner
  • βœ… Update Release Notes and Update Helper on new feature change/addition
  • βœ… Release Varbase 10.0.0-beta1 β†’ , varbase_components-2.0.0-alpha14 β†’

Varbase update type

  • βœ… No Update
  • βž– Optional Update
  • βž– Forced Update
  • βž– Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡―πŸ‡΄Jordan ahmad abbad Jordan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024