You are here

class Yahoo in Add to Cal 8

Provides generic calendar type (ics).

Plugin annotation


@AddToCalType(
  id = "yahoo",
  label = @Translation("Yahoo Calendar"),
  description = @Translation("Yahoo calendar type.")
)

Hierarchy

Expanded class hierarchy of Yahoo

File

src/Plugin/AddToCal/Type/Yahoo.php, line 20

Namespace

Drupal\addtocal\Plugin\AddToCal\Type
View source
class Yahoo extends AddToCalTypeBase {

  /**
   * Generates a Yahoo! calendar link
   *
   * @param array $info
   * @return \Drupal\Core\Url
   */
  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;
  }

  /**
   * @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

Namesort descending Modifiers Type Description Overrides
AddToCalTypeBase::$dateFormatter protected property The date formatter service.
AddToCalTypeBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create 1
AddToCalTypeBase::DT_FORMAT constant
AddToCalTypeBase::extractEventDetails protected function
AddToCalTypeBase::extractFieldValue protected function
AddToCalTypeBase::getName public function Return the name of the type plugin. Overrides AddToCalTypeInterface::getName
AddToCalTypeBase::RF3339_FORMAT constant
AddToCalTypeBase::rfc3339Date protected function Returns an array containing RFC 3339 formatted start and end dates.
AddToCalTypeBase::__construct public function Constructs a AddToCalPluginBase object. Overrides PluginBase::__construct 1
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
Yahoo::downloadSubmit public function @inheritdoc Overrides AddToCalTypeInterface::downloadSubmit
Yahoo::generateStructure public function Generates a Yahoo! calendar link Overrides AddToCalTypeInterface::generateStructure