trait TestActionTrait in Search API 8
Reusable code for test actions.
Hierarchy
- trait \Drupal\search_api_test_bulk_form\Plugin\Action\TestActionTrait
File
- tests/
search_api_test_bulk_form/ src/ Plugin/ Action/ TestActionTrait.php, line 12
Namespace
Drupal\search_api_test_bulk_form\Plugin\ActionView source
trait TestActionTrait {
/**
* {@inheritdoc}
*/
public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
return $return_as_object ? AccessResult::allowed() : TRUE;
}
/**
* {@inheritdoc}
*/
public function execute(EntityInterface $entity = NULL) {
$result = \Drupal::state()
->get('search_api_test_bulk_form', []);
$result[] = [
$this
->getPluginId(),
$entity
->getEntityTypeId(),
$entity
->id(),
];
\Drupal::state()
->set('search_api_test_bulk_form', $result);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TestActionTrait:: |
public | function | ||
TestActionTrait:: |
public | function |