class Google in Add to Cal 8
Provides google calendar type.
Plugin annotation
@AddToCalType(
id = "google",
label = @Translation("Google Calendar"),
description = @Translation("Google calendar type.")
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\addtocal\AddToCalTypeBase implements AddToCalTypeInterface
- class \Drupal\addtocal\Plugin\AddToCal\Type\Google
- class \Drupal\addtocal\AddToCalTypeBase implements AddToCalTypeInterface
Expanded class hierarchy of Google
1 string reference to 'Google'
- AddToCalForm::buildForm in src/
Form/ AddToCalForm.php
File
- src/
Plugin/ AddToCal/ Type/ Google.php, line 20
Namespace
Drupal\addtocal\Plugin\AddToCal\TypeView source
class Google extends AddToCalTypeBase {
/**
* Generates a google calendar link
*
* @param array $info
* @return \Drupal\Core\Url
*/
public function generateStructure(array $info) {
$url = Url::fromUri('http://www.google.com/calendar/event', [
'query' => [
'action' => 'TEMPLATE',
'text' => $info['title'],
'dates' => $info['rfc3339']['both'],
'sprop' => 'website:' . $_SERVER['HTTP_HOST'],
'location' => $info['location'],
'details' => $info['description'],
],
]);
return $url;
}
/**
* @inheritdoc
*/
public function downloadSubmit(EntityInterface $entity, array $settings, $delta, FormStateInterface $form_state) {
$eventDetails = $this
->extractEventDetails($entity, $settings, $delta);
/** @var Url $url */
$url = $this
->generateStructure($eventDetails);
// External URLS require to be a trusted response
$response = new TrustedRedirectResponse($url
->toString());
$form_state
->setResponse($response);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AddToCalTypeBase:: |
protected | property | The date formatter service. | |
AddToCalTypeBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
1 |
AddToCalTypeBase:: |
constant | |||
AddToCalTypeBase:: |
protected | function | ||
AddToCalTypeBase:: |
protected | function | ||
AddToCalTypeBase:: |
public | function |
Return the name of the type plugin. Overrides AddToCalTypeInterface:: |
|
AddToCalTypeBase:: |
constant | |||
AddToCalTypeBase:: |
protected | function | Returns an array containing RFC 3339 formatted start and end dates. | |
AddToCalTypeBase:: |
public | function |
Constructs a AddToCalPluginBase object. Overrides PluginBase:: |
1 |
Google:: |
public | function |
@inheritdoc Overrides AddToCalTypeInterface:: |
|
Google:: |
public | function |
Generates a google calendar link Overrides AddToCalTypeInterface:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. |