Skip to content
Snippets Groups Projects
Verified Commit 381c38a9 authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3359240 by Utkarsh_33, narendraR, deviantintegral, lauriii,...

Issue #3359240 by Utkarsh_33, narendraR, deviantintegral, lauriii, tim.plunkett, smustgrave, joachim, ckrina, hooroomoo: Enable bundle selection when a new view mode is created
parent e0cbbca6
Branches
Tags
46 merge requests!54479.5.x SF update,!5014Issue #3071143: Table Render Array Example Is Incorrect,!4868Issue #1428520: Improve menu parent link selection,!4594Applying patch for Views Global Text area field to allow extra HTML tags. As video, source and iframe tag is not rendering. Due to which Media embedded video and remote-video not rendering in Views Global Text area field.,!4289Issue #1344552 by marcingy, Niklas Fiekas, Ravi.J, aleevas, Eduardo Morales...,!3878Removed unused condition head title for views,!38582585169-10.1.x,!3825Issue #2972573: randomMachineName() should conform to processMachineName() pattern,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3668Resolve #3347842 "Deprecate the trusted",!3651Issue #3347736: Create new SDC component for Olivero (header-search),!3546refactored dialog.pcss file,!3531Issue #3336994: StringFormatter always displays links to entity even if the user in context does not have access,!3502Issue #3335308: Confusing behavior with FormState::setFormState and FormState::setMethod,!3452Issue #3332701: Refactor Claro's tablesort-indicator stylesheet,!3451Issue #2410579: Allows setting the current language programmatically.,!3355Issue #3209129: Scrolling problems when adding a block via layout builder,!3228Issue #2920678: Add config validation for the allowed characters of machine names,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3147Issue #3328457: Replace most substr($a, $i) where $i is negative with str_ends_with(),!3146Issue #3328456: Replace substr($a, 0, $i) with str_starts_with(),!3133core/modules/system/css/components/hidden.module.css,!31312878513-10.1.x,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2614Issue #2981326: Replace non-test usages of \Drupal::logger() with IoC injection,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2334Issue #3228209: Add hasRole() method to AccountInterface,!2062Issue #3246454: Add weekly granularity to views date sort,!1591Issue #3199697: Add JSON:API Translation experimental module,!1255Issue #3238922: Refactor (if feasible) uses of the jQuery serialize function to use vanillaJS,!1105Issue #3025039: New non translatable field on translatable content throws error,!1073issue #3191727: Focus states on mobile second level navigation items fixed,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!844Resolve #3036010 "Updaters",!673Issue #3214208: FinishResponseSubscriber could create duplicate headers,!617Issue #3043725: Provide a Entity Handler for user cancelation,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!485Sets the autocomplete attribute for username/password input field on login form.,!30Issue #3182188: Updates composer usage to point at ./vendor/bin/composer
......@@ -86,7 +86,7 @@
prepareDialogButtons($dialog) {
const buttons = [];
const $buttons = $dialog.find(
'.form-actions input[type=submit], .form-actions a.button',
'.form-actions input[type=submit], .form-actions a.button, .form-actions a.action-link',
);
$buttons.each(function () {
const $originalButton = $(this).css({ display: 'none' });
......
......@@ -2,6 +2,7 @@ field_ui.entity_view_mode_add:
route_name: field_ui.entity_view_mode_add
title: 'Add view mode'
weight: 1
class: \Drupal\field_ui\DisplayModeLocalAction
appears_on:
- entity.entity_view_mode.collection
......@@ -9,6 +10,7 @@ field_ui.entity_form_mode_add:
route_name: field_ui.entity_form_mode_add
title: 'Add form mode'
weight: 1
class: \Drupal\field_ui\DisplayModeLocalAction
appears_on:
- entity.entity_form_mode.collection
......
......@@ -2,6 +2,7 @@
namespace Drupal\field_ui\Controller;
use Drupal\Component\Serialization\Json;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Url;
......@@ -22,14 +23,26 @@ public function viewModeTypeSelection() {
if ($entity_type->get('field_ui_base_route') && $entity_type->hasViewBuilderClass()) {
$entity_types[$entity_type_id] = [
'title' => $entity_type->getLabel(),
'url' => Url::fromRoute('entity.entity_view_mode.add_form', ['entity_type_id' => $entity_type_id]),
'localized_options' => [],
'url' => Url::fromRoute('entity.entity_view_mode.add_form', ['entity_type_id' => $entity_type_id])->setOption('attributes', [
'class' => ['use-ajax'],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'width' => '880',
]),
]),
];
}
}
// Move content at the top.
array_splice($entity_types, 0, 0, array_splice($entity_types, array_search('node', array_keys($entity_types)), 1));
return [
'#theme' => 'admin_block_content',
'#content' => $entity_types,
'#attached' => [
'library' => [
'core/drupal.dialog.ajax',
],
],
];
}
......@@ -45,14 +58,26 @@ public function formModeTypeSelection() {
if ($entity_type->get('field_ui_base_route') && $entity_type->hasFormClasses()) {
$entity_types[$entity_type_id] = [
'title' => $entity_type->getLabel(),
'url' => Url::fromRoute('entity.entity_form_mode.add_form', ['entity_type_id' => $entity_type_id]),
'localized_options' => [],
'url' => Url::fromRoute('entity.entity_form_mode.add_form', ['entity_type_id' => $entity_type_id])->setOption('attributes', [
'class' => ['use-ajax'],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'width' => '880',
]),
]),
];
}
}
// Move content at the top.
array_splice($entity_types, 0, 0, array_splice($entity_types, array_search('node', array_keys($entity_types)), 1));
return [
'#theme' => 'admin_block_content',
'#content' => $entity_types,
'#attached' => [
'library' => [
'core/drupal.dialog.ajax',
],
],
];
}
......
<?php
namespace Drupal\field_ui;
use Drupal\Component\Serialization\Json;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Menu\LocalActionDefault;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Defines a local action plugin with modal dialog.
*/
class DisplayModeLocalAction extends LocalActionDefault {
/**
* {@inheritdoc}
*/
public function getOptions(RouteMatchInterface $route_match) {
$options = parent::getOptions($route_match);
$options = NestedArray::mergeDeepArray([[
'attributes' => [
'class' => ['button', 'use-ajax'],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'width' => '880',
]),
],
], $options,
]);
return $options;
}
}
......@@ -2,6 +2,8 @@
namespace Drupal\field_ui;
use Drupal\Component\Serialization\Json;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageInterface;
......@@ -69,6 +71,31 @@ public function buildRow(EntityInterface $entity) {
return $row + parent::buildRow($entity);
}
/**
* {@inheritdoc}
*/
public function getOperations(EntityInterface $entity) {
// Make the edit form render in a dialog, like the add form.
// The edit form also contains an option to delete the view mode, which
// also spawns a dialog. Rather than have nested dialogs, we allow the
// existing dialog to be replaced, so users will be shown the list again
// if they cancel deleting the view mode.
$operations = parent::getOperations($entity);
if (isset($operations['edit'])) {
$operations['edit'] = NestedArray::mergeDeepArray([[
'attributes' => [
'class' => ['button', 'use-ajax'],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'width' => '880',
]),
],
], $operations['edit'],
]);
}
return $operations;
}
/**
* {@inheritdoc}
*/
......@@ -117,7 +144,20 @@ public function render() {
'data' => [
'#type' => 'link',
'#url' => Url::fromRoute($short_type == 'view' ? 'entity.entity_view_mode.add_form' : 'entity.entity_form_mode.add_form', ['entity_type_id' => $entity_type]),
'#title' => $this->t('Add new @entity-type %label', ['@entity-type' => $this->entityTypes[$entity_type]->getLabel(), '%label' => $this->entityType->getSingularLabel()]),
'#title' => $this->t('Add %label for @entity-type', ['@entity-type' => $this->entityTypes[$entity_type]->getLabel(), '%label' => $this->entityType->getSingularLabel()]),
'#button_type' => 'primary',
'#attributes' => [
'class' => ['button', 'use-ajax', 'button--small'],
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'width' => '880',
]),
],
'#attached' => [
'library' => [
'core/drupal.dialog.ajax',
],
],
],
'colspan' => count($table['#header']),
];
......
......@@ -12,19 +12,12 @@
*/
class EntityDisplayModeAddForm extends EntityDisplayModeFormBase {
/**
* The entity type for which the display mode is being created.
*
* @var string
*/
protected $targetEntityTypeId;
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $entity_type_id = NULL) {
$this->targetEntityTypeId = $entity_type_id;
$form = parent::buildForm($form, $form_state);
$form = parent::buildForm($form, $form_state, $entity_type_id);
// Change replace_pattern to avoid undesired dots.
$form['id']['#machine_name']['replace_pattern'] = '[^a-z0-9_]+';
$definition = $this->entityTypeManager->getDefinition($this->targetEntityTypeId);
......
......@@ -2,8 +2,15 @@
namespace Drupal\field_ui\Form;
use Drupal\Core\Entity\Display\EntityFormDisplayInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityDisplayRepositoryInterface;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\field_ui\FieldUI;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides the generic base class for entity display mode forms.
......@@ -17,12 +24,58 @@ abstract class EntityDisplayModeFormBase extends EntityForm {
*/
protected $entityType;
/**
* The display context. Either 'view' or 'form'.
*
* @var string
*/
protected string $displayContext;
/**
* The entity type for which the display mode is being created or edited.
*
* @var string|null
*/
protected ?string $targetEntityTypeId;
/**
* {@inheritdoc}
*/
protected function init(FormStateInterface $form_state) {
parent::init($form_state);
$this->entityType = $this->entityTypeManager->getDefinition($this->entity->getEntityTypeId());
$this->displayContext = str_replace(['entity_', '_mode'], '', $this->entityType->id());
}
/**
* Constructs a EntityDisplayModeFormBase object.
*
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entityTypeBundleInfo
* The entity type bundle service.
* @param \Drupal\Core\Entity\EntityDisplayRepository $entityDisplayRepository
* The entity display repository.
*/
public function __construct(protected EntityTypeBundleInfoInterface $entityTypeBundleInfo, protected EntityDisplayRepositoryInterface $entityDisplayRepository) {}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity_type.bundle.info'),
$container->get('entity_display.repository'),
);
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $entity_type_id = NULL) {
if (!$entity_type_id && !$this->entity->isNew()) {
$entity_type_id = $this->entity->getTargetType();
}
$this->targetEntityTypeId = $entity_type_id;
return parent::buildForm($form, $form_state);
}
/**
......@@ -47,6 +100,30 @@ public function form(array $form, FormStateInterface $form_state) {
'replace_pattern' => '[^a-z0-9_.]+',
],
];
$bundle_info_service = $this->entityTypeBundleInfo;
$bundles = $bundle_info_service->getAllBundleInfo();
$definition = $this->entityTypeManager->getDefinition($this->entity->isNew() ? $this->targetEntityTypeId : $this->entity->getTargetType());
$bundles_by_entity = [];
$defaults = [];
foreach (array_keys($bundles[$definition->id()]) as $bundle) {
$bundles_by_entity[$bundle] = $bundles[$definition->id()][$bundle]['label'];
// Determine default display modes.
if (!$this->entity->isNew()) {
[, $display_mode_name] = explode('.', $this->entity->id());
if ($this->getDisplayByContext($bundle, $display_mode_name)) {
$defaults[$bundle] = $bundle;
}
}
}
$form['bundles_by_entity'] = [
'#type' => 'checkboxes',
'#title' => $this->t('Enable this @display-mode for the following @bundle-label types:', ['@display-mode' => $this->entityType->getSingularLabel(), '@bundle-label' => $definition->getLabel()]),
'#description' => $this->t('This @display-mode will still be available for the rest of the @bundle-label types if not checked here, but it will not be enabled by default.', ['@bundle-label' => $definition->getLabel(), '@display-mode' => $this->entityType->getSingularLabel()]),
'#options' => $bundles_by_entity,
'#default_value' => $defaults,
];
return $form;
}
......@@ -83,6 +160,132 @@ public function save(array $form, FormStateInterface $form_state) {
$this->entity->save();
\Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
$form_state->setRedirectUrl($this->entity->toUrl('collection'));
[, $display_mode_name] = explode('.', $form_state->getValue('id'));
$target_entity_id = $this->targetEntityTypeId;
foreach ($form_state->getValue('bundles_by_entity') as $bundle => $value) {
if (!empty($value)) {
// Add a new entity view/form display if it doesn't already exist.
if (!$this->getDisplayByContext($bundle, $display_mode_name)) {
$display = $this->getEntityDisplay($target_entity_id, $bundle, 'default')->createCopy($display_mode_name);
$display->save();
}
// This message is still helpful, even if the view/form display hasn't
// changed, so we keep it outside the above check.
$url = $this->getOverviewUrl($display_mode_name, $value);
$bundle_info_service = $this->entityTypeBundleInfo;
$bundles = $bundle_info_service->getAllBundleInfo();
$bundle_label = $bundles[$target_entity_id][$bundle]['label'];
$display_mode_label = $form_state->getValue('label');
$this->messenger()->addStatus($this->t('<a href=":url">Configure the %display_mode_label %mode mode for %bundle_label</a>.', ['%mode' => $this->displayContext, '%display_mode_label' => $display_mode_label, '%bundle_label' => $bundle_label, ':url' => $url->toString()]));
}
else {
// The view/form display has been unchecked, so we need to delete this.
// There's no confirmation of deleting the view/form display on the node
// content type forms either, so we match that behavior.
if ($display = $this->getDisplayByContext($bundle, $display_mode_name)) {
$display->delete();
}
}
}
}
/**
* Returns an entity display object to be used by this form.
*
* @param string $entity_type_id
* The target entity type ID of the entity display.
* @param string $bundle
* The target bundle of the entity display.
* @param string $mode
* A view or form mode.
*
* @return \Drupal\Core\Entity\Display\EntityDisplayInterface
* An entity display.
*/
private function getEntityDisplay($entity_type_id, $bundle, $mode) {
return match($this->displayContext) {
'view' => $this->entityDisplayRepository->getViewDisplay($entity_type_id, $bundle, $mode),
'form' => $this->entityDisplayRepository->getFormDisplay($entity_type_id, $bundle, $mode),
};
}
/**
* Returns the Url object for a specific entity (form) display edit form.
*
* @param string $mode
* The form or view mode.
* @param string $bundle
* The entity bundle name.
*
* @return \Drupal\Core\Url
* A Url object for the overview route.
*/
private function getOverviewUrl($mode, $bundle): Url {
$entity_type = $this->entityTypeManager->getDefinition($this->targetEntityTypeId);
return match($this->displayContext) {
'view' => Url::fromRoute('entity.entity_view_display.' . $this->targetEntityTypeId . '.view_mode', [
'view_mode_name' => $mode,
] + FieldUI::getRouteBundleParameter($entity_type, $bundle)),
'form' => Url::fromRoute('entity.entity_form_display.' . $this->targetEntityTypeId . '.form_mode', [
'form_mode_name' => $mode,
] + FieldUI::getRouteBundleParameter($entity_type, $bundle)),
};
}
/**
* Load the view display for a given bundle and view mode name.
*
* @param string $bundle
* The entity bundle to load the view display for.
* @param string $view_mode_name
* The view mode name such as "full_content" to load the view display for.
*
* @return \Drupal\Core\Entity\Display\EntityViewDisplayInterface|null
* Returns the view display, or NULL if one does not exist.
*/
private function getViewDisplay(string $bundle, string $view_mode_name): ?EntityViewDisplayInterface {
$view_mode_id = $this->targetEntityTypeId . '.' . $bundle . '.' . $view_mode_name;
return $this->entityTypeManager->getStorage('entity_view_display')->load($view_mode_id);
}
/**
* Load the form display for a given bundle and form mode name.
*
* @param string $bundle
* The entity bundle to load the form display for.
* @param string $form_mode_name
* The form mode name to load the form display for.
*
* @return \Drupal\Core\Entity\Display\EntityFormDisplayInterface|null
* Returns the form display, or NULL if one does not exist.
*/
private function getFormDisplay(string $bundle, string $form_mode_name): ?EntityFormDisplayInterface {
$form_mode_id = $this->targetEntityTypeId . '.' . $bundle . '.' . $form_mode_name;
return $this->entityTypeManager->getStorage('entity_form_display')->load($form_mode_id);
}
/**
* Returns View or Form display based on display context.
*
* @param string $bundle
* The entity bundle to load the display for.
* @param string $display_mode_name
* The display mode name to load the display for.
*
* @return \Drupal\Core\Entity\Display\EntityFormDisplayInterface|\Drupal\Core\Entity\Display\EntityViewDisplayInterface|null
* Returns the display, or NULL if one does not exist.
*/
private function getDisplayByContext(string $bundle, string $display_mode_name): EntityFormDisplayInterface|EntityViewDisplayInterface|null {
return match($this->displayContext) {
'view' => $this->getViewDisplay($bundle, $display_mode_name),
'form' => $this->getFormDisplay($bundle, $display_mode_name),
};
}
}
<?php
namespace Drupal\Tests\field_ui\FunctionalJavascript;
use Drupal\Core\Entity\Entity\EntityFormMode;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests the bundle selection for view & form display modes.
*
* @group field_ui
*/
class DisplayModeBundleSelectionTest extends WebDriverTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'field_ui',
'block',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->drupalCreateContentType([
'name' => 'Article',
'type' => 'article',
]);
$this->drupalCreateContentType([
'name' => 'Page',
'type' => 'page',
]);
$this->drupalPlaceBlock('local_actions_block');
$user = $this->drupalCreateUser([
'administer display modes',
'administer node display',
'administer node form display',
]);
// Create a new form mode 'foobar' for content.
EntityFormMode::create([
'id' => 'node.foobar',
'targetEntityType' => 'node',
'label' => 'Foobar',
])->save();
$this->drupalLogin($user);
}
/**
* Tests the bundle selection.
*
* @param string $display_mode
* View or Form display mode.
* @param string $path
* Display mode path.
* @param string $custom_mode
* Custom mode to test.
*
* @dataProvider providerBundleSelection
*/
public function testBundleSelection($display_mode, $path, $custom_mode) {
$page = $this->getSession()->getPage();
$assert_session = $this->assertSession();
// Add new display mode for content.
$this->drupalGet("/admin/structure/display-modes/$display_mode");
$this->assertNotEmpty($assert_session->waitForText("Add $display_mode mode"));
$this->clickLink("Add $display_mode mode for Content");
$this->assertNotEmpty($assert_session->waitForText("Add new Content $display_mode mode"));
$page->find('css', '[data-drupal-selector="edit-label"]')->setValue('test');
$page->find('css', '[data-drupal-selector="edit-bundles-by-entity-article"]')->check();
$page->find('css', '.ui-dialog-buttonset')->pressButton('Save');
// Verify that test display mode is selected for article content type.
$this->drupalGet("/admin/structure/types/manage/article/$path");
$page->find('css', '[data-drupal-selector="edit-modes"]')->pressButton('Custom display settings');
$checkbox = $page->find('css', '[data-drupal-selector="edit-display-modes-custom-test"]');
$this->assertTrue($checkbox->isChecked());
// Verify that test display mode is not selected for page content type.
$this->drupalGet("/admin/structure/types/manage/page/$path");
$page->find('css', '[data-drupal-selector="edit-modes"]')->pressButton('Custom display settings');
$checkbox = $page->find('css', '[data-drupal-selector="edit-display-modes-custom-test"]');
$this->assertFalse($checkbox->isChecked());
// Click Add view/form display mode button.
$this->drupalGet("/admin/structure/display-modes/$display_mode");
$this->assertNotEmpty($assert_session->waitForText("Add $display_mode mode"));
$this->clickLink("Add $display_mode mode");
$this->assertNotEmpty($assert_session->waitForText("Choose $display_mode mode entity type"));
// Add new view/form display mode for content.
$this->clickLink('Content');
$this->assertNotEmpty($assert_session->waitForText("Add new Content $display_mode mode"));
$page->find('css', '[data-drupal-selector="edit-label"]')->setValue('test2');
$page->find('css', '[data-drupal-selector="edit-bundles-by-entity-article"]')->check();
$page->find('css', '.ui-dialog-buttonset')->pressButton('Save');
// Verify that test2 display mode is selected for article content type.
$this->drupalGet("/admin/structure/types/manage/article/$path");
$page->find('css', '[data-drupal-selector="edit-modes"]')->pressButton('Custom display settings');
$checkbox = $page->find('css', '[data-drupal-selector="edit-display-modes-custom-test2"]');
$this->assertTrue($checkbox->isChecked());
// Verify that test2 display mode is not selected for page content type.
$this->drupalGet("/admin/structure/types/manage/page/$path");
$page->find('css', '[data-drupal-selector="edit-modes"]')->pressButton('Custom display settings');
$checkbox = $page->find('css', '[data-drupal-selector="edit-display-modes-custom-test2"]');
$this->assertFalse($checkbox->isChecked());
// Verify that display mode is not selected on article content type.
$this->drupalGet("/admin/structure/types/manage/article/$path");
$page->find('css', '[data-drupal-selector="edit-modes"]')->pressButton('Custom display settings');
$checkbox = $page->find('css', "[data-drupal-selector='edit-display-modes-custom-$custom_mode']");
$this->assertFalse($checkbox->isChecked());
// Edit existing display mode and enable it for article content type.
$this->drupalGet("/admin/structure/display-modes/$display_mode");
$this->assertNotEmpty($assert_session->waitForText("Add $display_mode mode"));
$page->find('xpath', '//ul[@class = "dropbutton"]/li[1]/a')->click();
$this->assertNotEmpty($assert_session->waitForText("This $display_mode mode will still be available for the rest of the Content types if not checked here, but it will not be enabled by default."));
$page->find('css', '[data-drupal-selector="edit-bundles-by-entity-article"]')->check();
$page->find('css', '.ui-dialog-buttonset')->pressButton('Save');
// Verify that display mode is selected on article content type.
$this->drupalGet("/admin/structure/types/manage/article/$path");
$page->find('css', '[data-drupal-selector="edit-modes"]')->pressButton('Custom display settings');
$checkbox = $page->find('css', "[data-drupal-selector='edit-display-modes-custom-$custom_mode']");
$this->assertTrue($checkbox->isChecked());
}
/**
* Data provider for testBundleSelection().
*/
public function providerBundleSelection() {
return [
'view display' => ['view', 'display', 'full'],
'form display' => ['form', 'form-display', 'foobar'],
];
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment