library_management_system-1.0.1/src/LmsBookViewBuilder.php

src/LmsBookViewBuilder.php
<?php

namespace Drupal\library_management_system;

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder;

/**
 * Render controller for lmsbooks.
 */
class LmsBookViewBuilder extends EntityViewBuilder {

  /**
   * {@inheritdoc}
   */
  public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
    $entity = $this->entityRepository->getTranslationFromContext($entity, $langcode);

    // Ajax request might send the view mode as a GET argument, use that
    // instead.
    if (\Drupal::request()->query->has('view_mode')) {
      $view_mode = \Drupal::request()->query->get('view_mode');
    }

    $output = parent::view($entity, $view_mode, $langcode);
    $output['#theme_wrappers'] = array('container');
    $output['#attributes']['class'][] = 'lmsbook-view';
    $output['#attributes']['class'][] = $view_mode;

    $output['#lmsbook'] = $entity;

    return $output;

  }

}

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

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