Problem/Motivation

I have created a video mode for brightcove_video entity, but when I try to enable the Use custom display settings for the following view modes I am getting the following error:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "hidden" plugin does not exist. Valid plugin IDs for Drupal\Core\Field\FormatterPluginManager are: address_country_default, address_zone_default, address_plain, address_default, comment_default, comment_permalink, comment_username, content_moderation_state, datetime_custom, datetime_time_ago, datetime_plain, datetime_default, daterange_custom, daterange_default, daterange_plain, file_default, file_uri, file_rss_enclosure, file_table, file_link, file_audio, file_size, file_filemime, file_url_plain, file_extension, file_video, image, image_url, link, link_separate, oembed, media_thumbnail, metatag_empty_formatter, list_key, list_default, redirect_source, entity_reference_rss_category, telephone_link, text_summary_or_trimmed, text_default, text_trimmed, number_time, author, user_name, number_unformatted, basic_string, number_integer, number_decimal, string, entity_reference_entity_view, language, timestamp, timestamp_ago, entity_reference_entity_id, boolean, email_mailto, uri_link, entity_reference_label in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('hidden') (Line: 56)
Drupal\Core\Field\FormatterPluginManager->createInstance('hidden', Array) (Line: 81)
Drupal\Core\Plugin\DefaultLazyPluginCollection->initializePlugin('hidden') (Line: 80)
Drupal\Component\Plugin\LazyPluginCollection->get('hidden') (Line: 148)
Drupal\Component\Plugin\LazyPluginCollection->getIterator() (Line: 114)
Drupal\Core\Plugin\DefaultLazyPluginCollection->getConfiguration() (Line: 293)
Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object) (Line: 259)
Drupal\Core\Entity\EntityDisplayBase->preSave(Object) (Line: 494)
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 449)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 252)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 592)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 565)
Drupal\field_ui\Form\EntityDisplayFormBase->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 113)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('entity_view_display_edit_form', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 578)
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: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
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: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 717)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

1. Enable brightcove module
2. Go to /admin/structure/display-modes/vi and add a new view mode for Brightcove Video
3. Go to /admin/structure/brightcove_video/settings/display and enable custom display settings for view mode created in step 2
This results in above mentioned error.

Reason: Brightcove video entity uses ['type' => 'hidden'] to hide the fields, which is now replaced with region, refer to the changelog.

Proposed resolution

Replace ['type' => 'hidden'] with ['region' => 'hidden'] in /src/Entity/BrightcoveVideo.php

Remaining tasks

1. Create a patch
2. Review the patch

Issue fork brightcove-3257008

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Shriaas created an issue. See original summary.

shriaas’s picture

Title: Unable to use custom display settings for view modes » Unable to use custom display settings for view modes on brightcove video entity
shriaas’s picture

Issue summary: View changes
shriaas’s picture

Assigned: Unassigned » shriaas

Creating a patch with suggested solution.

shriaas’s picture

Assigned: shriaas » Unassigned
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new7.16 KB

Replaced ['type' => 'hidden'] with ['region' => 'hidden'] in /src/Entity/BrightcoveVideo.php and /src/Entity/BrightcovePlaylist.php

  • yce committed edcce6d on 3.x
    Issue #3257008 by Shriaas: Unable to use custom display settings for...
yce’s picture

Version: 3.0.0 » 3.x-dev
Status: Needs review » Fixed

Hi,

Actually the type was left there to be backwards compatible with D8 still.
Adding the missing ['region' => 'hidden'] solves the issue.

Also in your patch you have duplicated the region key a few times.

I've pushed the fix to the latest dev.

shriaas’s picture

Actually the type was left there to be backward compatible with D8 still.

Oh okay, but since D8 has reached EOL, I guess it is safe to remove that?

Also in your patch you have duplicated the region key a few times.

My bad, just noticed that.

Thanks for pushing the changes!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.