From f38c23939abcb2f517f993fd61a55bc30027b918 Mon Sep 17 00:00:00 2001 From: catch Date: Wed, 22 Feb 2023 11:10:47 +0000 Subject: [PATCH] Issue #2815301 by Chi, DanielVeza, kostyashupenko, smustgrave: Allow to create any kind of actions through UI --- .../modules/action/src/Form/ActionAdminManageForm.php | 4 +--- .../action/tests/src/Functional/ActionListTest.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/modules/action/src/Form/ActionAdminManageForm.php b/core/modules/action/src/Form/ActionAdminManageForm.php index 51fdfabdb3b0..72a032b1b580 100644 --- a/core/modules/action/src/Form/ActionAdminManageForm.php +++ b/core/modules/action/src/Form/ActionAdminManageForm.php @@ -53,9 +53,7 @@ class ActionAdminManageForm extends FormBase { public function buildForm(array $form, FormStateInterface $form_state) { $actions = []; foreach ($this->manager->getDefinitions() as $id => $definition) { - if (is_subclass_of($definition['class'], '\Drupal\Core\Plugin\PluginFormInterface')) { - $actions[$id] = $definition['label']; - } + $actions[$id] = $definition['label']; } asort($actions); $form['parent'] = [ diff --git a/core/modules/action/tests/src/Functional/ActionListTest.php b/core/modules/action/tests/src/Functional/ActionListTest.php index 0f0869280d78..fdfcfd5bf51a 100644 --- a/core/modules/action/tests/src/Functional/ActionListTest.php +++ b/core/modules/action/tests/src/Functional/ActionListTest.php @@ -16,7 +16,7 @@ class ActionListTest extends BrowserTestBase { * * @var array */ - protected static $modules = ['action']; + protected static $modules = ['action', 'user']; /** * {@inheritdoc} @@ -39,4 +39,13 @@ class ActionListTest extends BrowserTestBase { $this->assertSession()->pageTextContains('There are no actions yet.'); } + /** + * Tests that non-configurable actions can be created by the UI. + */ + public function testNonConfigurableActionsCanBeCreated() { + $this->drupalLogin($this->drupalCreateUser(['administer actions'])); + $this->drupalGet('/admin/config/system/actions'); + $this->assertSession()->elementExists('css', 'select > option[value="user_block_user_action"]'); + } + }