public function ViewsAddButtonField::checkButtonAccess in Views Add Button 8
Same name and namespace in other branches
- 2.0.x src/Plugin/views/field/ViewsAddButtonField.php \Drupal\views_add_button\Plugin\views\field\ViewsAddButtonField::checkButtonAccess()
1 call to ViewsAddButtonField::checkButtonAccess()
- ViewsAddButtonField::render in src/
Plugin/ views/ field/ ViewsAddButtonField.php - Renders the field.
File
- src/
Plugin/ views/ field/ ViewsAddButtonField.php, line 195
Class
- ViewsAddButtonField
- Defines a views field plugin.
Namespace
Drupal\views_add_button\Plugin\views\fieldCode
public function checkButtonAccess($plugin_definitions, $default_plugin, $entity_type, $bundle) {
$access = FALSE;
$plugin_class = $default_plugin;
if (isset($this->options['access_plugin']) && isset($plugin_definitions[$this->options['access_plugin']]['class'])) {
$plugin_class = $plugin_definitions[$this->options['access_plugin']]['class'];
}
if (method_exists($plugin_class, 'checkAccess')) {
$context = $this->options['tokenize'] ? $this
->tokenizeValue($this->options['context']) : $this->options['context'];
$access = $plugin_class::checkAccess($entity_type, $bundle, $context);
}
else {
$entity_manager = \Drupal::entityTypeManager();
$access_handler = $entity_manager
->getAccessControlHandler($entity_type);
if ($bundle) {
$access = $access_handler
->createAccess($bundle);
}
else {
$access = $access_handler
->createAccess();
}
}
return $access;
}