abstract class RabbitHoleBehaviorPluginBase in Rabbit Hole 2.x
Same name and namespace in other branches
- 8 src/Plugin/RabbitHoleBehaviorPluginBase.php \Drupal\rabbit_hole\Plugin\RabbitHoleBehaviorPluginBase
Base class for Rabbit hole behavior plugin plugins.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\rabbit_hole\Plugin\RabbitHoleBehaviorPluginBase implements RabbitHoleBehaviorPluginInterface
Expanded class hierarchy of RabbitHoleBehaviorPluginBase
4 files declare their use of RabbitHoleBehaviorPluginBase
- AccessDenied.php in src/
Plugin/ RabbitHoleBehaviorPlugin/ AccessDenied.php - DisplayPage.php in src/
Plugin/ RabbitHoleBehaviorPlugin/ DisplayPage.php - PageNotFound.php in src/
Plugin/ RabbitHoleBehaviorPlugin/ PageNotFound.php - PageRedirect.php in src/
Plugin/ RabbitHoleBehaviorPlugin/ PageRedirect.php
File
- src/
Plugin/ RabbitHoleBehaviorPluginBase.php, line 13
Namespace
Drupal\rabbit_hole\PluginView source
abstract class RabbitHoleBehaviorPluginBase extends PluginBase implements RabbitHoleBehaviorPluginInterface {
/**
* {@inheritdoc}
*/
public function performAction(EntityInterface $entity) {
// Perform no action.
}
/**
* {@inheritdoc}
*/
public function settingsForm(array &$form, FormStateInterface $form_state, $form_id, EntityInterface $entity = NULL, $entity_is_bundle = FALSE, ImmutableConfig $bundle_settings = NULL) {
// Present no settings form.
}
/**
* {@inheritdoc}
*/
public function settingsFormHandleSubmit(&$form, &$form_state) {
// No extra action to handle submission by default.
}
/**
* {@inheritdoc}
*/
public function alterExtraFields(array &$fields) {
// Don't change the fields by default.
}
/**
* {@inheritdoc}
*/
public function usesResponse() {
return RabbitHoleBehaviorPluginInterface::USES_RESPONSE_NEVER;
}
/**
* Returns configuration object with "Rabbit Hole" bundle settings.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity the action is being performed on.
*
* @return \Drupal\Core\Config\ImmutableConfig
* Configuration object with bundle settings.
*/
protected function getBundleSettings(EntityInterface $entity) {
$bundle_entity_type = $entity
->getEntityType()
->getBundleEntityType();
return \Drupal::service('rabbit_hole.behavior_settings_manager')
->loadBehaviorSettingsAsConfig($bundle_entity_type ?: $entity
->getEntityType()
->id(), $bundle_entity_type ? $entity
->bundle() : NULL);
}
/**
* Returns the fallback action in case if action cannot be performed.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity the action is being performed on.
*
* @return string
* Fallback action name.
*/
protected function getFallbackAction(EntityInterface $entity) {
return 'access_denied';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
2 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginBase:: |
public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | 98 |
RabbitHoleBehaviorPluginBase:: |
public | function |
Add to or adjust the fields added by rabbit hole. Overrides RabbitHoleBehaviorPluginInterface:: |
1 |
RabbitHoleBehaviorPluginBase:: |
protected | function | Returns configuration object with "Rabbit Hole" bundle settings. | |
RabbitHoleBehaviorPluginBase:: |
protected | function | Returns the fallback action in case if action cannot be performed. | 1 |
RabbitHoleBehaviorPluginBase:: |
public | function |
Perform the rabbit hole action. Overrides RabbitHoleBehaviorPluginInterface:: |
3 |
RabbitHoleBehaviorPluginBase:: |
public | function |
Return a settings form for the rabbit hole action. Overrides RabbitHoleBehaviorPluginInterface:: |
1 |
RabbitHoleBehaviorPluginBase:: |
public | function |
Handle submission of the settings form for this plugin. Overrides RabbitHoleBehaviorPluginInterface:: |
|
RabbitHoleBehaviorPluginBase:: |
public | function |
Get whether this plugin uses a response to perform its action. Overrides RabbitHoleBehaviorPluginInterface:: |
|
RabbitHoleBehaviorPluginInterface:: |
constant | |||
RabbitHoleBehaviorPluginInterface:: |
constant | |||
RabbitHoleBehaviorPluginInterface:: |
constant |