You are here

protected function Calendar::renderTitle in Calendar 8.2

1 call to Calendar::renderTitle()
Calendar::render in src/Plugin/views/style/Calendar.php
Render the display in this style.

File

src/Plugin/views/style/Calendar.php, line 400

Class

Calendar
Views style plugin for the Calendar module.

Namespace

Drupal\calendar\Plugin\views\style

Code

protected function renderTitle($rowentity) {
  $entity_type = $this
    ->getBaseEntityType();
  $entity_id = $rowentity
    ->Id();
  if ($this->options['multi_allday_style'] === "1") {
    $view_mode = $this->options['multi_allday_viewmode'];
    $entity = \Drupal::entityTypeManager()
      ->getStorage($entity_type)
      ->load($entity_id);
    $view_builder = \Drupal::entityTypeManager()
      ->getViewBuilder($entity_type);
    $pre_render = $view_builder
      ->view($entity, $view_mode);
    return render($pre_render);
  }
  else {
    if ($this->options['multi_allday_title'] === "1") {
      switch ($entity_type) {
        case 'user':
          $link = Link::createFromRoute($rowentity
            ->get('title')->value, 'entity.user.canonical', [
            'user' => $entity_id,
          ]);
          break;
        default:
          $link = Link::createFromRoute($rowentity
            ->get('title')->value, 'entity.node.canonical', [
            'node' => $entity_id,
          ]);
      }
      return $link;
    }
    else {
      return $rowentity
        ->get('title')->value;
    }
  }
}