buildAdministrativeSection example

$this->prepareLayout($section_storage);

    $output = [];
    if ($this->isAjax()) {
      $output['status_messages'] = [
        '#type' => 'status_messages',
      ];
    }
    $count = 0;
    for ($i = 0; $i < $section_storage->count()$i++) {
      $output[] = $this->buildAddSectionLink($section_storage$count);
      $output[] = $this->buildAdministrativeSection($section_storage$count);
      $count++;
    }
    $output[] = $this->buildAddSectionLink($section_storage$count);
    $output['#attached']['library'][] = 'layout_builder/drupal.layout_builder';
    // As the Layout Builder UI is typically displayed using the frontend theme,     // it is not marked as an administrative page at the route level even though     // it performs an administrative task. Mark this as an administrative page     // for JavaScript.     $output['#attached']['drupalSettings']['path']['currentPathIsAdmin'] = TRUE;
    $output['#type'] = 'container';
    $output['#attributes']['id'] = 'layout-builder';
    
Home | Imprint | This part of the site doesn't use cookies.