You are here

public function IcalWizard::render in Views iCal 8

Render the display in this style.

Overrides StylePluginBase::render

File

src/Plugin/views/style/IcalWizard.php, line 223

Class

IcalWizard
Style plugin to render an iCal feed. This provides a style usable for Feed displays.

Namespace

Drupal\views_ical\Plugin\views\style

Code

public function render() {
  if (empty($this->view->rowPlugin)) {
    trigger_error('Drupal\\views_ical\\Plugin\\views\\style\\Ical: Missing row plugin', E_WARNING);
    return [];
  }
  $this->helper
    ->setView($this->view);

  // '-//Drupal iCal API//EN' becomes the PRODID
  $calendar = new Calendar('-//Drupal iCal API//EN');
  $this->calendar = $calendar;
  $parent_render = parent::render();

  // Sets the 'X-WR-CALNAME" property. Just use the View name here.
  if ($this->view
    ->getTitle()) {
    $calendar
      ->setName($this->view
      ->getTitle());
  }
  $build = [
    //      '#markup' => $render,
    '#markup' => $calendar
      ->render(),
  ];
  unset($this->view->row_index);

  //What is this doing?
  return $build;
}