function ShortcutTestBase::generateShortcutSet
Same name in this branch
- 8.9.x core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php \Drupal\Tests\shortcut\Functional\ShortcutTestBase::generateShortcutSet()
Same name in other branches
- 9 core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php \Drupal\Tests\shortcut\Functional\ShortcutTestBase::generateShortcutSet()
- 10 core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php \Drupal\Tests\shortcut\Functional\ShortcutTestBase::generateShortcutSet()
- 11.x core/modules/shortcut/tests/src/Functional/ShortcutTestBase.php \Drupal\Tests\shortcut\Functional\ShortcutTestBase::generateShortcutSet()
Creates a generic shortcut set.
File
-
core/
modules/ shortcut/ src/ Tests/ ShortcutTestBase.php, line 103
Class
- ShortcutTestBase
- Defines base class for shortcut test cases.
Namespace
Drupal\shortcut\TestsCode
public function generateShortcutSet($label = '', $id = NULL) {
$set = ShortcutSet::create([
'id' => isset($id) ? $id : strtolower($this->randomMachineName()),
'label' => empty($label) ? $this->randomString() : $label,
]);
$set->save();
return $set;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.