Issue #3265850: Show fallback field formatter until user actively edits the field
Closed
requested to merge issue/editablefields-3265850:3265850-show-fallback-field-formatter into 1.0.x
3 unresolved threads
Merge request reports
Activity
added 1 commit
- 4346ceaa - Allow setting a fallback view mode and edit toggle.
added 2 commits
97 99 '#type' => 'select', 98 100 '#title' => $this->t('View mode'), 99 101 '#default_value' => $this->getSetting('view_mode'), 100 '#required' => TRUE, 101 102 '#empty_option' => $this->t('- Select a view mode -'), 102 103 '#options' => $this->editablefieldsHelper->getViewModesOptions($this->fieldDefinition->getTargetEntityTypeId(), $this->viewMode), 103 104 '#states' => [ 104 105 'visible' => [ 105 'input[name="fields[' . $this->fieldDefinition->getName() . '][settings_edit_form][settings][enable_toggle]"]' => ['checked' => TRUE], 106 $selector => ['checked' => TRUE], 107 ], 108 'required' => [ I have checked this and I can see that what I had didn't work. Your fix should fix it, however it doesn't work as the field is never full compulsory. You can still save the settings.
This might have something to do with https://www.drupal.org/project/drupal/issues/2855139
Solution is: remove the empty option, that forces users to select a view mode.
changed this line in version 6 of the diff
106 147 $items = $this->entity->get($field); 107 148 $items->filterEmptyItems(); 108 149 109 // Get a widget form. 110 $form[$field] = $widget->form($items, $form, $form_state); 111 $form[$field]['#access'] = $items->access('edit'); 112 113 $form['submit'] = [ 114 '#type' => 'submit', 115 '#value' => $this->t('Update'), 116 '#ajax' => [ 117 'callback' => [$this, 'ajaxCallback'], 118 'wrapper' => str_replace('_', '-', $this->getFormId()), 119 ], 120 ]; 150 if (!$this->enableToggle) { changed this line in version 7 of the diff
109 // Get a widget form. 110 $form[$field] = $widget->form($items, $form, $form_state); 111 $form[$field]['#access'] = $items->access('edit'); 112 113 $form['submit'] = [ 114 '#type' => 'submit', 115 '#value' => $this->t('Update'), 116 '#ajax' => [ 117 'callback' => [$this, 'ajaxCallback'], 118 'wrapper' => str_replace('_', '-', $this->getFormId()), 119 ], 120 ]; 150 if (!$this->showButtonToEdit) { 151 // Get a widget form. 152 $form[$field] = $widget->form($items, $form, $form_state); 153 $form[$field]['#access'] = $items->access('edit'); added 3 commits
-
bc398946...df336cab - 2 commits from branch
project:1.0.x
- ba0da450 - Merge branch '3265850-show-fallback-field-formatter' of...
-
bc398946...df336cab - 2 commits from branch
Please register or sign in to reply