class BlockPluginHasSettingsTrayFormAccessCheck in Drupal 8
Same name and namespace in other branches
- 9 core/modules/settings_tray/src/Access/BlockPluginHasSettingsTrayFormAccessCheck.php \Drupal\settings_tray\Access\BlockPluginHasSettingsTrayFormAccessCheck
Determines whether the requested block has a 'settings_tray' form.
@internal
Hierarchy
- class \Drupal\settings_tray\Access\BlockPluginHasSettingsTrayFormAccessCheck implements AccessInterface
Expanded class hierarchy of BlockPluginHasSettingsTrayFormAccessCheck
1 file declares its use of BlockPluginHasSettingsTrayFormAccessCheck
- BlockPluginHasSettingsTrayFormAccessCheckTest.php in core/
modules/ settings_tray/ tests/ src/ Unit/ Access/ BlockPluginHasSettingsTrayFormAccessCheckTest.php
1 string reference to 'BlockPluginHasSettingsTrayFormAccessCheck'
- settings_tray.services.yml in core/
modules/ settings_tray/ settings_tray.services.yml - core/modules/settings_tray/settings_tray.services.yml
1 service uses BlockPluginHasSettingsTrayFormAccessCheck
File
- core/
modules/ settings_tray/ src/ Access/ BlockPluginHasSettingsTrayFormAccessCheck.php, line 16
Namespace
Drupal\settings_tray\AccessView source
class BlockPluginHasSettingsTrayFormAccessCheck implements AccessInterface {
/**
* Checks access for accessing a block's 'settings_tray' form.
*
* @param \Drupal\block\BlockInterface $block
* The block whose 'settings_tray' form is being accessed.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*/
public function access(BlockInterface $block) {
/** @var \Drupal\Core\Block\BlockPluginInterface $block_plugin */
$block_plugin = $block
->getPlugin();
return $this
->accessBlockPlugin($block_plugin);
}
/**
* Checks access for accessing a block plugin's 'settings_tray' form.
*
* @param \Drupal\Core\Block\BlockPluginInterface $block_plugin
* The block plugin whose 'settings_tray' form is being accessed.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*
* @see settings_tray_preprocess_block()
*/
public function accessBlockPlugin(BlockPluginInterface $block_plugin) {
return AccessResult::allowedIf($block_plugin instanceof PluginWithFormsInterface && $block_plugin
->hasFormClass('settings_tray'));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BlockPluginHasSettingsTrayFormAccessCheck:: |
public | function | Checks access for accessing a block's 'settings_tray' form. | |
BlockPluginHasSettingsTrayFormAccessCheck:: |
public | function | Checks access for accessing a block plugin's 'settings_tray' form. |