Commit 0b5587bf authored by alexpott's avatar alexpott

Issue #2341455 by swentel, cosmicdreams: Creating a new view mode should clear...

Issue #2341455 by swentel, cosmicdreams: Creating a new view mode should clear cache, so the new view mode can be displayed
parent f1536191
......@@ -11,6 +11,7 @@
use Drupal\Core\Render\Element;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Entity\EntityViewModeInterface;
use Drupal\Core\Entity\EntityFormModeInterface;
use Drupal\Core\Url;
use Drupal\field_ui\FieldUI;
use Drupal\field_ui\Plugin\Derivative\FieldUiLocalTask;
......@@ -165,16 +166,30 @@ function field_ui_form_node_type_form_submit($form, FormStateInterface $form_sta
}
/**
* Implements hook_view_mode_presave().
* Implements hook_entity_view_mode_presave().
*/
function field_ui_view_mode_presave(EntityViewModeInterface $view_mode) {
function field_ui_entity_view_mode_presave(EntityViewModeInterface $view_mode) {
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
}
/**
* Implements hook_view_mode_delete().
* Implements hook_entity_form_mode_presave().
*/
function field_ui_view_mode_delete(EntityViewModeInterface $view_mode) {
function field_ui_entity_form_mode_presave(EntityFormModeInterface $form_mode) {
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
}
/**
* Implements hook_entity_view_mode_delete().
*/
function field_ui_entity_view_mode_delete(EntityViewModeInterface $view_mode) {
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
}
/**
* Implements hook_entity_form_mode_delete().
*/
function field_ui_entity_form_mode_delete(EntityFormModeInterface $form_mode) {
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
}
......
......@@ -72,6 +72,28 @@ public function testFieldUIRoutes() {
$this->assertTitle('Manage form display | Drupal');
$this->assertLocalTasks();
$this->assert(count($this->xpath('//ul/li[1]/a[contains(text(), :text)]', array(':text' => 'Default'))) == 1, 'Default secondary tab is in first position.');
// Create new view mode and verify it's available on the Manage Display
// screen after enabling it.
entity_create('entity_view_mode' ,array(
'id' => 'user.test',
'label' => 'Test',
'targetEntityType' => 'user',
))->save();
$edit = array('display_modes_custom[test]' => TRUE);
$this->drupalPostForm('admin/config/people/accounts/display', $edit, t('Save'));
$this->assertLink('Test');
// Create new form mode and verify it's available on the Manage Form
// Display screen after enabling it.
entity_create('entity_form_mode' ,array(
'id' => 'user.test',
'label' => 'Test',
'targetEntityType' => 'user',
))->save();
$edit = array('display_modes_custom[test]' => TRUE);
$this->drupalPostForm('admin/config/people/accounts/form-display', $edit, t('Save'));
$this->assertLink('Test');
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment