diff --git a/recipes/drupal_cms_starter/composer.json b/recipes/drupal_cms_starter/composer.json index 22c033156c9ec87b3a1036a737b246684b7d330c..d2e8dbafdaa16a33857ec5b3ceac33d74d978688 100644 --- a/recipes/drupal_cms_starter/composer.json +++ b/recipes/drupal_cms_starter/composer.json @@ -7,7 +7,7 @@ "drupal/automatic_updates": "^3.1.7", "drupal/bpmn_io": "^2.0.3", "drupal/core": ">=10.4", - "drupal/eca": "^2.1", + "drupal/eca": "^2.1.2", "drupal/dashboard": "^2", "drupal/drupal_cms_admin_ui": "^1", "drupal/drupal_cms_anti_spam": "^1", diff --git a/recipes/drupal_cms_starter/config/eca.eca.rename_project_browser_tabs.yml b/recipes/drupal_cms_starter/config/eca.eca.rename_project_browser_tabs.yml new file mode 100644 index 0000000000000000000000000000000000000000..63778038abec10972578b14423a339a653178d74 --- /dev/null +++ b/recipes/drupal_cms_starter/config/eca.eca.rename_project_browser_tabs.yml @@ -0,0 +1,45 @@ +langcode: en +status: true +dependencies: + module: + - eca_project_browser +id: rename_project_browser_tabs +modeller: fallback +label: 'Rename Project Browser tabs' +version: 1.0.0 +weight: 0 +events: + Event_alter_source_info: + plugin: 'project_browser:source_info_alter' + label: 'Alter source plugin info' + configuration: { } + successors: + - + id: Activity_set_title + condition: '' + - + id: Activity_0dlv38b + condition: '' +conditions: { } +gateways: { } +actions: + Activity_set_title: + plugin: eca_project_browser_source_plugin_info_alter + label: 'Change title of recipes tab' + configuration: + plugin_id: recipes + label: '' + description: '' + local_task_title: Recommended + local_task_weight: '0' + successors: { } + Activity_0dlv38b: + plugin: eca_project_browser_source_plugin_info_alter + label: 'Change title of contributed modules tab' + configuration: + plugin_id: drupalorg_jsonapi + label: '' + description: '' + local_task_title: 'Browse modules' + local_task_weight: '' + successors: { } diff --git a/recipes/drupal_cms_starter/recipe.yml b/recipes/drupal_cms_starter/recipe.yml index 35029517cf8f50c6c0222781c7d9ba92dc450cdd..31008fbe45ebdeac40da1d8a49d383f3bbc70a2e 100644 --- a/recipes/drupal_cms_starter/recipe.yml +++ b/recipes/drupal_cms_starter/recipe.yml @@ -23,6 +23,7 @@ install: - eca_base - eca_config - eca_content + - eca_project_browser - eca_render - menu_link_content - olivero diff --git a/recipes/drupal_cms_starter/tests/src/Functional/ComponentValidationTest.php b/recipes/drupal_cms_starter/tests/src/Functional/ComponentValidationTest.php index 038208c9099ff1097e5c127f46cda3b403199216..5ae5c1e1e65be2d588401d717f4ea32b9e037d35 100644 --- a/recipes/drupal_cms_starter/tests/src/Functional/ComponentValidationTest.php +++ b/recipes/drupal_cms_starter/tests/src/Functional/ComponentValidationTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Drupal\Tests\drupal_cms_starter\Functional; +use Behat\Mink\Element\NodeElement; use Composer\InstalledVersions; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\State\StateInterface; @@ -159,12 +160,32 @@ class ComponentValidationTest extends BrowserTestBase { $assert_session->linkExists("Search for this $node_type"); } - // If you have permission to administer modules, you should see a dedicated - // tab to browse recipes. + // Ensure that the Project Browser local tasks work as expected. $account = $this->drupalCreateUser(['administer modules']); $this->drupalLogin($account); - $this->drupalGet('/admin/modules/browse/recipes'); - $assert_session->statusCodeEquals(200); + $this->drupalGet('/admin/modules'); + // Get the Project Browser local tasks. + $elements = $assert_session->elementExists('css', 'h2:contains("Primary tabs") + nav') + ->findAll('css', 'ul li a'); + $local_tasks = []; + /** @var \Behat\Mink\Element\NodeElement $element */ + foreach ($elements as $element) { + $link_text = $element->getText(); + $local_tasks[$link_text] = $element->getAttribute('data-drupal-link-system-path'); + } + // The first task should go to core's regular modules page. + $this->assertSame('admin/modules', reset($local_tasks)); + // Ensure the Project Browser tasks are in the expected order, have the + // expected link text, and link to the expected place. + $project_browser_tasks = preg_grep('|admin/modules/browse/.+|', $local_tasks); + $this->assertSame(['Recommended', 'Browse modules'], array_keys($project_browser_tasks)); + $this->assertStringEndsWith('/recipes', $project_browser_tasks['Recommended']); + $this->assertStringEndsWith('/drupalorg_jsonapi', $project_browser_tasks['Browse modules']); + // We should have access to all Project Browser tasks. + foreach ($project_browser_tasks as $path) { + $this->drupalGet($path); + $assert_session->statusCodeEquals(200); + } } }