Issue #2815301 by Chi, DanielVeza, kostyashupenko, smustgrave: Allow to create any kind of actions through UI

merge-requests/3360/merge
catch 2023-02-22 11:10:47 +00:00
parent 85c9ee6ab8
commit f38c23939a
2 changed files with 11 additions and 4 deletions

View File

@ -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'] = [

View File

@ -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"]');
}
}