You are here

private function ParagraphsFrontendUIController::getParentData in Paragraphs frontend ui 8.2

Same name and namespace in other branches
  1. 8 src/Controller/ParagraphsFrontendUIController.php \Drupal\paragraphs_frontend_ui\Controller\ParagraphsFrontendUIController::getParentData()

Helper function to get the required data about the parent of the paragraph.

6 calls to ParagraphsFrontendUIController::getParentData()
ParagraphsFrontendUIController::accessDown in src/Controller/ParagraphsFrontendUIController.php
Check if this is the last paragraph in an entity, if not, deny access.
ParagraphsFrontendUIController::accessLibraryItem in src/Controller/ParagraphsFrontendUIController.php
Check if the settings form mode exists for this paragraph.
ParagraphsFrontendUIController::accessUp in src/Controller/ParagraphsFrontendUIController.php
Check if this is the first paragraph in an entity, if not, deny access.
ParagraphsFrontendUIController::down in src/Controller/ParagraphsFrontendUIController.php
Shift down a single paragraph.
ParagraphsFrontendUIController::duplicate in src/Controller/ParagraphsFrontendUIController.php
Duplicate a paragraph.

... See full list

File

src/Controller/ParagraphsFrontendUIController.php, line 259

Class

ParagraphsFrontendUIController
Controller for up and down actions.

Namespace

Drupal\paragraphs_frontend_ui\Controller

Code

private function getParentData($paragraph) {
  $parent = $paragraph
    ->getParentEntity()
    ->getTranslation($this
    ->langcode());
  return [
    'parent' => $parent,
    'parent_type' => $parent
      ->getEntityTypeId(),
    'parent_bundle' => $parent
      ->bundle(),
    'parent_entity_id' => $parent
      ->id(),
    'parent_field_name' => $paragraph
      ->get('parent_field_name')
      ->getValue()[0]['value'],
  ];
}