page_layouts-1.0.1/src/Plugin/Layouts/FullWidthBodyText.php

src/Plugin/Layouts/FullWidthBodyText.php
<?php

declare(strict_types=1);

namespace Drupal\page_layouts\Plugin\Layouts;

use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\page_layouts\LayoutsPluginBase;

/**
 * Plugin implementation of the layouts.
 *
 * @Layouts(
 *   id = "layouts_full_width_body_text",
 *   label = @Translation("Full Width Body Text"),
 *   description = @Translation("Full width body of text.")
 * )
 */
final class FullWidthBodyText extends LayoutsPluginBase {
  use StringTranslationTrait;

  /**
   * {@inheritdoc}
   */
  public function getLayout($result) {

    $build['layout'] = [
      '#theme' => 'layouts_full_width_body_text',
      '#content' => [
        'content_1' => $result->content_1->value,
      ],
    ];

    return \Drupal::service('renderer')->render($build);
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc