You are here

public function PanelsIPEPageController::getBlockContentTypesData in Panels 8.4

Gets a list of Block Content Types from the server as data.

Parameters

string $panels_storage_type: The id of the storage plugin.

string $panels_storage_id: The id within the storage plugin for the requested Panels display.

Return value

array

1 call to PanelsIPEPageController::getBlockContentTypesData()
PanelsIPEPageController::getBlockContentTypes in panels_ipe/src/Controller/PanelsIPEPageController.php
Gets a list of Block Content Types from the server as JSON.

File

panels_ipe/src/Controller/PanelsIPEPageController.php, line 414

Class

PanelsIPEPageController
Contains all JSON endpoints required for Panels IPE + Page Manager.

Namespace

Drupal\panels_ipe\Controller

Code

public function getBlockContentTypesData($panels_storage_type, $panels_storage_id) {

  // Assemble our relevant data.
  $types = $this
    ->entityTypeManager()
    ->getStorage('block_content_type')
    ->loadMultiple();
  $data = [];

  /** @var \Drupal\block_content\BlockContentTypeInterface $definition */
  foreach ($types as $id => $definition) {
    $data[] = [
      'id' => $definition
        ->id(),
      'revision' => $definition
        ->shouldCreateNewRevision(),
      'label' => $definition
        ->label(),
      'description' => $definition
        ->getDescription(),
    ];
  }
  return $data;
}