Giter Site home page Giter Site logo

view_mode_selector's People

Contributors

axe312ger avatar bartfeenstra avatar borisson avatar ivegas avatar jhuhta avatar maijs avatar mariacha avatar stefdewa avatar szatom avatar yannickoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

view_mode_selector's Issues

override view mode labels

We should add an option to let the user override the label of a view mode, maybe only for default - that would make sense.

Php 7.4 compatibility - 7.x - implode syntax deprecation warning

On view_mode_selector 7.12 with php 7.4

When editing a page that contains a view_mode_selector, we get
Deprecated function : implode(): Passing glue string after array is deprecated. Swap the parameters dans view_mode_selector_field_widget_form() (line 262 of /sites/all/modules/view_mode_selector/view_mode_selector.module).

Note this will be more critical on php 8.

Custom view mode not used (D8 dev version)

  1. Create a custom view mode
  2. Add view mode to content type
  3. Edit a node of the content type and change the view mode from the view mode selector field
  4. View mode value is saved but does not get applied on the node. Another view mode is used

Does't work with the icons

When i try to include an icon of a view mode selector the system shows this warning:

Warning: foreach() argument must be of type array|object, bool given in Drupal\file\Element\ManagedFile::valueCallback() (line 150 of core/modules/file/src/Element/ManagedFile.php).
Drupal\file\Element\ManagedFile::valueCallback(Array, , Object)
call_user_func_array(Array, Array) (Line: 1277)
Drupal\Core\Form\FormBuilder->handleInputElement('field_config_edit_form', Array, Object) (Line: 1000)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 1070)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 1070)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 1070)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 1070)
Drupal\Core\Form\FormBuilder->doBuildForm('field_config_edit_form', Array, Object) (Line: 574)
Drupal\Core\Form\FormBuilder->processForm('field_config_edit_form', Array, Object) (Line: 320)
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: 564)
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: 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: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

And the icon it's not saved.

Drupal 9 Readiness fixes

Deprecation needs to be fixed to make it compatible with Drupal 9.

Deprecation List for 1.x-dev:

  • view_mode_selector\src\Plugin\Field\FieldType\ViewModeSelectorItem.php 83 Call to deprecated method entityManager() of class Drupal. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0

  • view_mode_selector\src\Plugin\Field\FieldWidget\ViewModeSelectorIcons.php 43 Call to deprecated method entityManager() of class Drupal. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.

  • view_mode_selector\src\Plugin\Field\FieldWidget\ViewModeSelectorWidgetBase.php 32 Call to deprecated method entityManager() of class Drupal. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.

  • view_mode_selector\src\Plugin\Field\FieldWidget\ViewModeSelectorWidgetBase.php 44 Call to deprecated method entityManager() of class Drupal. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.

  • view_mode_selector\view_mode_selector.module 25 Call to deprecated method entityManager() of class Drupal. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.

  • view_mode_selector\view_mode_selector.module 41 Call to deprecated method entityManager() of class Drupal. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.

  • view_mode_selector\view_mode_selector.module 54 Call to deprecated method entityManager() of class Drupal. Deprecated in drupal:8.0.0 and is removed from drupal:9.0.0.

  • view_mode_selector\view_mode_selector.module 82 Call to deprecated function drupal_set_message(). Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0.

  • view_mode_selector\view_mode_selector.module 85 Call to deprecated function drupal_set_message(). Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0.

No Value

It would be great if there was an empty value option. This way it can be the "default" which is no field value.

Changing View Mode Selector settings in views error. Drupal 8.

I'm creating a view that takes the view_mode_selector argument from the node. The view takes the node id as a contextual filter and outputs the content to the selected style mentioned previously. See screenshot:
screen shot 2016-04-04 at 11 12 05

When I go to change the settings to how I output the content I get the following error message via ajax/javascript.
screen shot 2016-04-04 at 11 12 15

Just thought i'd post this here. Let me know if you need any more information regarding the error.

PHP 7.4 warning for implode

I'm getting this warning:

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in Drupal\view_mode_selector\Plugin\Field\FieldWidget\ViewModeSelectorIcons->formElement() (line 144 of src/Plugin/Field/FieldWidget/ViewModeSelectorIcons.php)

I guess the code should be to be this to be 7.4+ compatible

$element['value']['#options'][$view_mode] = implode('', $output);

View mode selector does not work with drupal 8 paragraphs

When I enable the view mode after adding the view mode field to paragraph bundle and select the view mode while creating content the node content display comes empty.

The classes of view mode are wrapped perfectly. The content area is empty.

Make icon file permanent

Hello, I'm using the module with the paragraph module and for a few days I notice that the icon file disappears suddenly, then I can see that the file disappears from the database too because was saved with status = 0.

I fix it using this code

`
/**

  • Implements hook_form_FORM_ID_alter().
    */
    function view_mode_selector_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id) {
    if ($form['#field']['type'] == 'view_mode_selector') {
    array_unshift($form['#submit'], 'view_mode_selector_settings_form_submit'); // <---- added
    // Don't allow more than one value for a view mode selector field.
    $form['field']['cardinality']['#access'] = FALSE;
    $form['field']['cardinality']['#value'] = 1;
    }
    }
    `

and

`
/**

  • Custom form submit handler
    */
    function view_mode_selector_settings_form_submit($form, &$form_state) {
    foreach ($form_state['values']['instance']['settings']['view_modes'] as $view_mode => $element) {
    if (!empty($element['icon'])) {
    $icon = file_load($element['icon']);
    if ($icon) {
    // make image file permanent
    $icon->status = FILE_STATUS_PERMANENT;
    file_save($icon);
    }
    }
    }
    }
    `

More information here

https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7.x/#managed_file

Ajax error

Cannot redeclare
View_mode_selector.module line 189

Seems like I can only add one paragraph with the View mode selector on a page. Adding a second paragraph that uses a view mode, throws an AJAX error.

This is for the latest version of the Drupal 7 module.

Cannot redeclare function error

When trying to add a new paragraphs entity to a node, I was getting an error about sortByRegionCount() being redeclared (line 189 of view_mode_selector.module). I think you need to move this function outside of view_mode_selector_view_modes(). You might also consider name spacing the function once moved to prevent collisions.

Ability to provide files as previews instead of fids

Great module!!

The forms for the preview stores a fid in the settings array.
When I deploy that to another server with features the fid is not the same.

Right now I'm solving that with a form alter wherever we show the previews but adding the ability to have a fixed path may be nice.

Thanks.

Drupal 8 release plan

Hey guys, I tried the module on simpletest.me switching the view mode of a paragraph and it seems to work fine. Do you already have plans when to port the module to beta on drupal.org? upgrade path and so on … Would be really good to know about the maintainance situation for the future. Thanks in advance!

sortByRegionCount - function already defined

In some circumstances (e.g. if view_mode_selector_field_widget_form is called multiple times) the function 'sortByRegionCount' is already defined and causes a fatal errors view_mode_selector_field_widget_form.module:188ff.

Let's wrap it in a function exists call

if (!function_exists('sortByRegionCount')) {
  // Sort Display Suite view modes by number of regions.
  function sortByRegionCount($a, $b) {
    return count($a['layout']['settings']['regions']) - count($b['layout']['settings']['regions']);
  }
}

D10 compatibility

There is a patch on drupal.org/projects/view_mode_selector to be merged to make this module D10 ready. This issue is to merge this patch.

Backdrop port

Thank you for your module. I use it on several sites and it works great. Now I need exactly same functionality on new Backdrop site, so I want to port this module to Backdrop and share with it in Backdrop-contrib.
To port your module only changing few lines of code is needed.
And I have to ask, do you guys interested in supporting a Backdrop version, or porting the module themselves?

WSOD with multiple view modes

I am using view mode selector with paragraphs module. I am trying to configure my various paragraph bundles have different view modes available (for example, I'd like to have a set of paragraphs where the author can select if they want it to be two or three columns and then use a multivalue field and then another set of paragraphs where they might have four images with a multivalue field - this part is working fine when VMS is not enabled). When VMS is enabled and I am adding additional paragraphs bundles to my content, I get an ajax error:

Fatal error:  Cannot redeclare sortByRegionCount() (previously declared in 
/sites/all/modules/contrib/view_mode_selector/view_mode_selector.module:189) in 
/sites/all/modules/contrib/view_mode_selector/view_mode_selector.module on line 189

If I try to edit a page that I had created prior to implementing VMS, I get WSOD.

Is it possible to use this with paragraphs to specify view modes for multiple paragraph bundles within a content type? It would be nice to have only a few paragraphs bundles with many display modes available.

I am going to also look into Entity VMS, as I realize I am trying to add this to multiple entities, and that might be more appropriate.

Undefined index: default in Drupal 8.x-1.x-dev

Steps to recreate (from a fresh simplytest.me site):

  1. Enable the View Mode Selector module.
  2. Manage fields for basic page.
  3. Add a View Mode Selector field and click save.
Notice: Undefined index: default in Drupal\view_mode_selector\Plugin\Field\FieldType\ViewModeSelectorItem->fieldSettingsForm() (line 99 of sites/default/modules/view_mode_selector/src/Plugin/Field/FieldType/ViewModeSelectorItem.php).
Drupal\view_mode_selector\Plugin\Field\FieldType\ViewModeSelectorItem->fieldSettingsForm(Array, Object) (Line: 95)
Drupal\field_ui\Form\FieldConfigEditForm->form(Array, Object) (Line: 120)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 517)
Drupal\Core\Form\FormBuilder->retrieveForm('field_config_edit_form', Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 79)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 128)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 577)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 129)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 102)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 62)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 103)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 55)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 637)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Notice: Undefined index: default in Drupal\view_mode_selector\Plugin\Field\FieldType\ViewModeSelectorItem->fieldSettingsForm() (line 109 of sites/default/modules/view_mode_selector/src/Plugin/Field/FieldType/ViewModeSelectorItem.php).
Drupal\view_mode_selector\Plugin\Field\FieldType\ViewModeSelectorItem->fieldSettingsForm(Array, Object) (Line: 95)
Drupal\field_ui\Form\FieldConfigEditForm->form(Array, Object) (Line: 120)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 517)
Drupal\Core\Form\FormBuilder->retrieveForm('field_config_edit_form', Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 79)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 128)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 577)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 129)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 102)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 62)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 103)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 55)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 637)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Notice: Undefined index: default in Drupal\view_mode_selector\Plugin\Field\FieldType\ViewModeSelectorItem->fieldSettingsForm() (line 122 of sites/default/modules/view_mode_selector/src/Plugin/Field/FieldType/ViewModeSelectorItem.php).
Drupal\view_mode_selector\Plugin\Field\FieldType\ViewModeSelectorItem->fieldSettingsForm(Array, Object) (Line: 95)
Drupal\field_ui\Form\FieldConfigEditForm->form(Array, Object) (Line: 120)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 517)
Drupal\Core\Form\FormBuilder->retrieveForm('field_config_edit_form', Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 79)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 128)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 577)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 129)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 102)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 62)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 103)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 55)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 637)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Notice: Undefined index: teaser in Drupal\view_mode_selector\Plugin\Field\FieldType\ViewModeSelectorItem->fieldSettingsForm() (line 99 of sites/default/modules/view_mode_selector/src/Plugin/Field/FieldType/ViewModeSelectorItem.php).
Drupal\view_mode_selector\Plugin\Field\FieldType\ViewModeSelectorItem->fieldSettingsForm(Array, Object) (Line: 95)
Drupal\field_ui\Form\FieldConfigEditForm->form(Array, Object) (Line: 120)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 517)
Drupal\Core\Form\FormBuilder->retrieveForm('field_config_edit_form', Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 79)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 128)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 577)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 129)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 102)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 62)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 103)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 55)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 637)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Notice: Undefined index: teaser in Drupal\view_mode_selector\Plugin\Field\FieldType\ViewModeSelectorItem->fieldSettingsForm() (line 109 of sites/default/modules/view_mode_selector/src/Plugin/Field/FieldType/ViewModeSelectorItem.php).
Drupal\view_mode_selector\Plugin\Field\FieldType\ViewModeSelectorItem->fieldSettingsForm(Array, Object) (Line: 95)
Drupal\field_ui\Form\FieldConfigEditForm->form(Array, Object) (Line: 120)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 517)
Drupal\Core\Form\FormBuilder->retrieveForm('field_config_edit_form', Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 79)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 128)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 577)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 129)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 102)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 62)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 103)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 55)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 637)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Notice: Undefined index: teaser in Drupal\view_mode_selector\Plugin\Field\FieldType\ViewModeSelectorItem->fieldSettingsForm() (line 122 of sites/default/modules/view_mode_selector/src/Plugin/Field/FieldType/ViewModeSelectorItem.php).
Drupal\view_mode_selector\Plugin\Field\FieldType\ViewModeSelectorItem->fieldSettingsForm(Array, Object) (Line: 95)
Drupal\field_ui\Form\FieldConfigEditForm->form(Array, Object) (Line: 120)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 517)
Drupal\Core\Form\FormBuilder->retrieveForm('field_config_edit_form', Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 79)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 128)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 577)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 129)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 102)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 62)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 103)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 55)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 637)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Strict warning: Only variables should be passed by reference in Drupal\view_mode_selector\Plugin\Field\FieldWidget\ViewModeSelectorRadios->formElement() (line 27 of sites/default/modules/view_mode_selector/src/Plugin/Field/FieldWidget/ViewModeSelectorRadios.php).
Drupal\view_mode_selector\Plugin\Field\FieldWidget\ViewModeSelectorRadios->formElement(Object, 0, Array, Array, Object) (Line: 329)
Drupal\Core\Field\WidgetBase->formSingleElement(Object, 0, Array, Array, Object) (Line: 194)
Drupal\Core\Field\WidgetBase->formMultipleElements(Object, Array, Object) (Line: 109)
Drupal\Core\Field\WidgetBase->form(Object, Array, Object) (Line: 303)
Drupal\Core\Field\FieldItemList->defaultValuesForm(Array, Object) (Line: 102)
Drupal\field_ui\Form\FieldConfigEditForm->form(Array, Object) (Line: 120)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 517)
Drupal\Core\Form\FormBuilder->retrieveForm('field_config_edit_form', Object) (Line: 276)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 79)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 128)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 577)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 129)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 102)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 62)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 103)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 55)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 637)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Adding view mode selector to an existing paragraph does not work

Problem/Motivation
I add the field view mode selector to an existing paragraph used in the website, then when i edit an existing paragraph it does not let me edit it, however if I create a new paragraph of this type in the node I can create it.

The PHP notice is
Notice: Only variables should be passed by reference in /view_mode_selector/src/Plugin/Field/FieldWidget/ViewModeSelectorRadios.php on line 27

Proposed resolution
Split $items[$delta]->value ?: reset(array_keys($this->viewModes)), in two variables to avoid it.

Specs
Drupal 8.6.10
PHP 7.1.26

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.