You are here

public function AddToOutlook::generateUrl in Open Social 10.1.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/modules/social_event_addtocal/src/Plugin/SocialAddToCalendar/AddToOutlook.php \Drupal\social_event_addtocal\Plugin\SocialAddToCalendar\AddToOutlook::generateUrl()
  2. 10.3.x modules/social_features/social_event/modules/social_event_addtocal/src/Plugin/SocialAddToCalendar/AddToOutlook.php \Drupal\social_event_addtocal\Plugin\SocialAddToCalendar\AddToOutlook::generateUrl()
  3. 10.0.x modules/social_features/social_event/modules/social_event_addtocal/src/Plugin/SocialAddToCalendar/AddToOutlook.php \Drupal\social_event_addtocal\Plugin\SocialAddToCalendar\AddToOutlook::generateUrl()
  4. 10.2.x modules/social_features/social_event/modules/social_event_addtocal/src/Plugin/SocialAddToCalendar/AddToOutlook.php \Drupal\social_event_addtocal\Plugin\SocialAddToCalendar\AddToOutlook::generateUrl()

Returns the 'Add to calendar' link.

Parameters

\Drupal\node\NodeInterface $node: The node entity.

Return value

\Drupal\Core\Url Url object.

Overrides SocialAddToCalendarBase::generateUrl

File

modules/social_features/social_event/modules/social_event_addtocal/src/Plugin/SocialAddToCalendar/AddToOutlook.php, line 26

Class

AddToOutlook
Provides add to Google calendar plugin.

Namespace

Drupal\social_event_addtocal\Plugin\SocialAddToCalendar

Code

public function generateUrl(NodeInterface $node) {
  $settings = $this
    ->generateSettings($node);
  $options = [
    'query' => [
      'path' => '/calendar/action/compose',
      'rru' => 'addevent',
      'subject' => $settings['title'],
      'startdt' => $settings['dates']['start'],
      'enddt' => $settings['dates']['end'],
      'allday' => $settings['dates']['all_day'] ? 'true' : 'false',
      'location' => $settings['location'],
    ],
    'attributes' => [
      'target' => '_blank',
    ],
  ];
  return Url::fromUri($this->pluginDefinition['url'], $options);
}