Yahoo.php in Add to Cal 8
File
src/Plugin/AddToCal/Type/Yahoo.php
View source
<?php
namespace Drupal\addtocal\Plugin\AddToCal\Type;
use Drupal\addtocal\AddToCalTypeBase;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\TrustedRedirectResponse;
use Drupal\Core\Url;
class Yahoo extends AddToCalTypeBase {
public function generateStructure(array $info) {
$url = Url::fromUri('http://calendar.yahoo.com/', [
'query' => [
'v' => 60,
'TITLE' => $info['title'],
'ST' => $info['rfc3339']['start'],
'ET' => $info['rfc3339']['end'],
'URL' => $_SERVER['HTTP_HOST'],
'in_loc' => $info['location'],
'desc' => $info['description'],
],
]);
return $url;
}
public function downloadSubmit(EntityInterface $entity, array $settings, $delta, FormStateInterface $form_state) {
$eventDetails = $this
->extractEventDetails($entity, $settings, $delta);
$url = $this
->generateStructure($eventDetails);
$response = new TrustedRedirectResponse($url
->toString());
$form_state
->setResponse($response);
}
}
Classes
Name |
Description |
Yahoo |
Provides generic calendar type (ics). |