public function ParagraphsFrontendUIController::accessDown in Paragraphs frontend ui 8
Same name and namespace in other branches
- 8.2 src/Controller/ParagraphsFrontendUIController.php \Drupal\paragraphs_frontend_ui\Controller\ParagraphsFrontendUIController::accessDown()
Check if this is the last paragraph in an entity, if not, deny access.
1 string reference to 'ParagraphsFrontendUIController::accessDown'
File
- src/
Controller/ ParagraphsFrontendUIController.php, line 123
Class
- ParagraphsFrontendUIController
- Controller for up and down actions.
Namespace
Drupal\paragraphs_frontend_ui\ControllerCode
public function accessDown($paragraph) {
$paragraph = Paragraph::load($paragraph);
extract($this
->getParentData($paragraph));
$paragraph_items = $parent->{$parent_field_name}
->getValue();
$last_item = end($paragraph_items);
if ($last_item['target_id'] == $paragraph
->id()) {
return AccessResult::forbidden();
}
else {
return AccessResult::allowed();
}
}