You are here

public function CalendarLinkTwigExtension::calendarLinks in Calendar Link 8

Same name and namespace in other branches
  1. 2.x src/Twig/CalendarLinkTwigExtension.php \Drupal\calendar_link\Twig\CalendarLinkTwigExtension::calendarLinks()

Create links for all calendar types.

Parameters

string $title: Calendar entry title.

\Drupal\Core\Datetime\DrupalDateTime|\DateTime $from: Calendar entry start date and time.

\Drupal\Core\Datetime\DrupalDateTime|\DateTime $to: Calendar entry end date and time.

bool $all_day: Indicator for an "all day" calendar entry.

string $description: Calendar entry description.

string $address: Calendar entry address.

Return value

array

  • type_key: Machine key for the calendar type.
  • type_name: Human-readable name for the calendar type.
  • url: URL for the specific calendar type.

File

src/Twig/CalendarLinkTwigExtension.php, line 122

Class

CalendarLinkTwigExtension
Class CalendarLinkTwigExtension.

Namespace

Drupal\calendar_link\Twig

Code

public function calendarLinks($title, $from, $to, $all_day = FALSE, $description = '', $address = '') {
  $links = [];
  foreach (self::$types as $type => $name) {
    $links[$type] = [
      'type_key' => $type,
      'type_name' => $name,
      'url' => $this
        ->calendarLink($type, $title, $from, $to, $all_day, $description, $address),
    ];
  }
  return $links;
}