Issue #2815301 by Chi, DanielVeza, kostyashupenko, smustgrave: Allow to create any kind of actions through UI
parent
85c9ee6ab8
commit
f38c23939a
|
@ -53,10 +53,8 @@ class ActionAdminManageForm extends FormBase {
|
||||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||||
$actions = [];
|
$actions = [];
|
||||||
foreach ($this->manager->getDefinitions() as $id => $definition) {
|
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);
|
asort($actions);
|
||||||
$form['parent'] = [
|
$form['parent'] = [
|
||||||
'#type' => 'details',
|
'#type' => 'details',
|
||||||
|
|
|
@ -16,7 +16,7 @@ class ActionListTest extends BrowserTestBase {
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected static $modules = ['action'];
|
protected static $modules = ['action', 'user'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
@ -39,4 +39,13 @@ class ActionListTest extends BrowserTestBase {
|
||||||
$this->assertSession()->pageTextContains('There are no actions yet.');
|
$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"]');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue