You are here

public function ParagraphsFrontendUIController::accessFormMode in Paragraphs frontend ui 8.2

Check if the form mode exists for this paragraph.

2 calls to ParagraphsFrontendUIController::accessFormMode()
ParagraphsFrontendUIController::accessEditContent in src/Controller/ParagraphsFrontendUIController.php
Check if the settings form mode exists for this paragraph.
ParagraphsFrontendUIController::accessEditSettings in src/Controller/ParagraphsFrontendUIController.php
Check if the settings form mode exists for this paragraph.

File

src/Controller/ParagraphsFrontendUIController.php, line 245

Class

ParagraphsFrontendUIController
Controller for up and down actions.

Namespace

Drupal\paragraphs_frontend_ui\Controller

Code

public function accessFormMode($paragraph, $form_mode) {
  $paragraph = Paragraph::load($paragraph);
  $display_config_id = 'core.entity_form_display.paragraph.' . $paragraph
    ->bundle() . '.' . $form_mode;
  if (\Drupal::configFactory()
    ->loadMultiple([
    $display_config_id,
  ])) {
    return AccessResult::allowed();
  }
  else {
    return AccessResult::forbidden();
  }
}