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

src/Plugin/Layouts/TextLeftTextRight.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_text_left_text_right",
 *   label = @Translation("Text Left Text Right"),
 *   description = @Translation("Text on the left text on the right each taking up half the space.")
 * )
 */
final class TextLeftTextRight extends LayoutsPluginBase {
  use StringTranslationTrait;

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

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

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

}

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

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