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
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3257008-replace-hidden-type-with-region.patch | 7.16 KB | shriaas |
Issue fork brightcove-3257008
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
Comment #2
shriaasComment #3
shriaasComment #4
shriaasCreating a patch with suggested solution.
Comment #5
shriaasReplaced
['type' => 'hidden']with['region' => 'hidden']in/src/Entity/BrightcoveVideo.phpand/src/Entity/BrightcovePlaylist.phpComment #7
yce commentedHi,
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.
Comment #8
shriaasOh okay, but since D8 has reached EOL, I guess it is safe to remove that?
My bad, just noticed that.
Thanks for pushing the changes!