You are here

public function ConfigureSectionController::title in Layout Builder UX 8

Returns the title for the configure section route.

Parameters

\Drupal\layout_builder\SectionStorageInterface $section_storage: The section storage.

int $delta: The delta of the section to splice.

string $plugin_id: The plugin ID of the layout to add.

Return value

string|\Drupal\Core\StringTranslation\TranslatableMarkup The route title.

File

src/Controller/ConfigureSectionController.php, line 149

Class

ConfigureSectionController
Attempts to add a new section, falls back to a form if necessary.

Namespace

Drupal\lb_ux\Controller

Code

public function title(SectionStorageInterface $section_storage, $delta, $plugin_id) {
  if (is_null($plugin_id)) {
    $layout_definition = $section_storage
      ->getSection($delta)
      ->getLayout()
      ->getPluginDefinition();
  }
  else {
    $layout_definition = $this->layoutPluginManager
      ->getDefinition($plugin_id);
  }
  return $this
    ->t('Configure @label section', [
    '@label' => $layout_definition
      ->getLabel(),
  ]);
}