You are here

protected function AjaxController::getFieldSetting in Paragraphs table 8

1 call to AjaxController::getFieldSetting()
AjaxController::json in src/Controller/AjaxController.php
Return output JSON object value.

File

src/Controller/AjaxController.php, line 105

Class

AjaxController
Returns responses for paragraphs item routes.

Namespace

Drupal\paragraphs_table\Controller

Code

protected function getFieldSetting($entity, $field_name) {
  $bundle = $entity
    ->bundle();
  $repository = \Drupal::service('entity_display.repository');
  $viewDisplay = $repository
    ->getViewDisplay($entity
    ->getEntityTypeId(), $bundle, 'default');
  $fieldComponent = $viewDisplay
    ->getComponent($field_name);
  return $fieldComponent['settings'];
}