RabbitHoleEntityPluginBase.php in Rabbit Hole 2.x
File
src/Plugin/RabbitHoleEntityPluginBase.php
View source
<?php
namespace Drupal\rabbit_hole\Plugin;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Core\Form\FormStateInterface;
abstract class RabbitHoleEntityPluginBase extends PluginBase implements RabbitHoleEntityPluginInterface {
public function getFormSubmitHandlerAttachLocations(array $form, FormStateInterface $form_state) {
return [
[
'actions',
'submit',
'#submit',
],
];
}
public function getBundleFormSubmitHandlerAttachLocations(array $form, FormStateInterface $form_state) {
return [
[
'actions',
'submit',
'#submit',
],
];
}
public function getGlobalConfigFormId() {
return NULL;
}
public function getGlobalFormSubmitHandlerAttachLocations(array $form, FormStateInterface $form_state) {
return [
[
'actions',
'submit',
'#submit',
],
];
}
public function getEntityTokenMap() {
$map = [];
$map[$this->pluginDefinition['entityType']] = $this->pluginDefinition['entityType'];
$bundle = \Drupal::entityTypeManager()
->getDefinition($this->pluginDefinition['entityType'])
->getBundleEntityType();
if (!empty($bundle)) {
$map[$bundle] = $bundle;
}
return $map;
}
}