Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • project/recurring_events
  • issue/recurring_events-3183502
  • issue/recurring_events-3183463
  • issue/recurring_events-3183483
  • issue/recurring_events-3190526
  • issue/recurring_events-3191715
  • issue/recurring_events-3190833
  • issue/recurring_events-3188808
  • issue/recurring_events-3180479
  • issue/recurring_events-3122823
  • issue/recurring_events-3196649
  • issue/recurring_events-3196428
  • issue/recurring_events-3196702
  • issue/recurring_events-3196704
  • issue/recurring_events-3198532
  • issue/recurring_events-3164409
  • issue/recurring_events-3206960
  • issue/recurring_events-3115678
  • issue/recurring_events-3218496
  • issue/recurring_events-3207435
  • issue/recurring_events-3219082
  • issue/recurring_events-3217367
  • issue/recurring_events-3229514
  • issue/recurring_events-3231841
  • issue/recurring_events-3238591
  • issue/recurring_events-3282502
  • issue/recurring_events-3283128
  • issue/recurring_events-3240862
  • issue/recurring_events-3247034
  • issue/recurring_events-3071679
  • issue/recurring_events-3264621
  • issue/recurring_events-3266436
  • issue/recurring_events-3268690
  • issue/recurring_events-3269555
  • issue/recurring_events-3271328
  • issue/recurring_events-3272361
  • issue/recurring_events-3163804
  • issue/recurring_events-3297681
  • issue/recurring_events-3299575
  • issue/recurring_events-3300786
  • issue/recurring_events-3302916
  • issue/recurring_events-3304286
  • issue/recurring_events-3298679
  • issue/recurring_events-3309652
  • issue/recurring_events-3310360
  • issue/recurring_events-3311843
  • issue/recurring_events-3311712
  • issue/recurring_events-3312003
  • issue/recurring_events-3312084
  • issue/recurring_events-3312242
  • issue/recurring_events-3316080
  • issue/recurring_events-3295367
  • issue/recurring_events-3196417
  • issue/recurring_events-3309859
  • issue/recurring_events-3318590
  • issue/recurring_events-3244975
  • issue/recurring_events-3318998
  • issue/recurring_events-3321269
  • issue/recurring_events-3320512
  • issue/recurring_events-3321235
  • issue/recurring_events-3321550
  • issue/recurring_events-3322998
  • issue/recurring_events-3315836
  • issue/recurring_events-3324055
  • issue/recurring_events-3328907
  • issue/recurring_events-3318490
  • issue/recurring_events-3339288
  • issue/recurring_events-3345618
  • issue/recurring_events-3347935
  • issue/recurring_events-3362297
  • issue/recurring_events-3359696
  • issue/recurring_events-3318666
  • issue/recurring_events-3366907
  • issue/recurring_events-3366910
  • issue/recurring_events-3403064
  • issue/recurring_events-3404311
  • issue/recurring_events-3405567
  • issue/recurring_events-3376639
  • issue/recurring_events-3384836
  • issue/recurring_events-3382387
  • issue/recurring_events-3384389
  • issue/recurring_events-3315503
  • issue/recurring_events-3411229
  • issue/recurring_events-3415222
  • issue/recurring_events-3415308
  • issue/recurring_events-3172514
  • issue/recurring_events-3419694
  • issue/recurring_events-3178696
  • issue/recurring_events-3408924
  • issue/recurring_events-3447130
  • issue/recurring_events-3416436
  • issue/recurring_events-3451613
  • issue/recurring_events-3452632
  • issue/recurring_events-3453086
  • issue/recurring_events-3452641
  • issue/recurring_events-3454012
  • issue/recurring_events-3455716
  • issue/recurring_events-3456300
  • issue/recurring_events-3456641
  • issue/recurring_events-3462327
  • issue/recurring_events-3463467
  • issue/recurring_events-3463979
  • issue/recurring_events-3462480
  • issue/recurring_events-3464792
  • issue/recurring_events-3456045
  • issue/recurring_events-3468300
  • issue/recurring_events-3468521
  • issue/recurring_events-3475611
  • issue/recurring_events-3477247
  • issue/recurring_events-3477047
  • issue/recurring_events-3477650
  • issue/recurring_events-3257502
  • issue/recurring_events-3090186
  • issue/recurring_events-3478802
  • issue/recurring_events-3479449
  • issue/recurring_events-3479843
  • issue/recurring_events-3479860
  • issue/recurring_events-3480495
  • issue/recurring_events-3480500
  • issue/recurring_events-3480746
  • issue/recurring_events-3480973
  • issue/recurring_events-3481021
  • issue/recurring_events-3481722
  • issue/recurring_events-3482804
  • issue/recurring_events-3483283
  • issue/recurring_events-3484209
  • issue/recurring_events-3170156
  • issue/recurring_events-3484558
  • issue/recurring_events-3485904
  • issue/recurring_events-3485935
  • issue/recurring_events-3487412
  • issue/recurring_events-3496270
  • issue/recurring_events-3480508
  • issue/recurring_events-3499792
  • issue/recurring_events-3500920
  • issue/recurring_events-3510919
  • issue/recurring_events-3510942
  • issue/recurring_events-3478268
138 results
Show changes
Showing
with 700 additions and 0 deletions
access group_recurring_events_series overview:
title: 'Access group recurring events series overview'
description: 'Access the overview of all group recurring events series, regardless of type'
name: 'Group recurring events'
description: 'Enables Group functionality for the Recurring events module'
package: 'Group'
type: 'module'
core_version_requirement: ^9.3 || ^10
dependencies:
- 'recurring_events:recurring_events'
- 'group:group'
<?php
/**
* @file
* Install, and update functions for group recurring events series module.
*/
group_content.group_recurring_events_series_relate_page:
route_name: 'entity.group_content.group_recurring_events_series_relate_page'
title: 'Add existing events'
appears_on:
- 'view.group_recurring_events_series.page_1'
group_content.group_recurring_events_series_add_page:
route_name: 'entity.group_content.group_recurring_events_series_add_page'
title: 'Add new events'
appears_on:
- 'view.group_recurring_events_series.page_1'
<?php
/**
* @file
* Enables Group functionality for the Recurring events module.
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;
use Drupal\recurring_events\Entity\EventSeriesTypeInterface;
/**
* Implements hook_ENTITY_TYPE_insert().
*/
function group_recurring_events_series_eventseries_type_insert(EventSeriesTypeInterface $eventseries_type) {
if (\Drupal::isConfigSyncing()) {
return;
}
\Drupal::service('plugin.manager.group_content_enabler')->clearCachedDefinitions();
}
/**
* Implements hook_entity_operation().
*/
function group_recurring_events_series_entity_operation(EntityInterface $entity) {
$operations = [];
if ($entity->getEntityTypeId() == 'group' && \Drupal::moduleHandler()->moduleExists('views')) {
/** @var \Drupal\group\Entity\GroupInterface $entity */
if ($entity->hasPermission('access group_recurring_events_series overview', \Drupal::currentUser())) {
/** @var \Symfony\Component\Routing\RouterInterface $router */
$router = \Drupal::service('router.no_access_checks');
if ($router->getRouteCollection()->get('view.group_recurring_events_series.page_1') !== NULL) {
$operations['recurring_events_series'] = [
'title' => t('Events series'),
'weight' => 20,
'url' => Url::fromRoute('view.group_recurring_events_series.page_1', ['group' => $entity->id()]),
];
}
}
}
return $operations;
}
/**
* Implements hook_entity_type_build().
*/
function group_recurring_events_series_entity_type_build(array &$entity_types) {
if (isset($entity_types['eventinstance'])) {
$entity_types['eventinstance']->setHandlerClass('access', 'Drupal\group_recurring_events_series\Access\GroupEventInstanceHandler');
}
}
route_callbacks:
- '\Drupal\group_recurring_events_series\Routing\GroupEventSeriesRouteProvider::getRoutes'
<?php
namespace Drupal\group_recurring_events_series\Access;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\recurring_events\EventInstanceAccessControlHandler;
/**
* The GroupEventInstanceHandler class.
*/
class GroupEventInstanceHandler extends EventInstanceAccessControlHandler {
/**
* Determine access for the group.
*/
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
$result = parent::checkAccess($entity, $operation, $account);
if (!$result->isAllowed()) {
// Need GroupContentAccessControlHandler not
// EventSeriesAccessControlHandler.
$manager = \Drupal::service('plugin.manager.group_content_enabler');
$type = 'group_recurring_events_series:' . $entity->getType();
if ($manager->hasHandler($type, 'access')) {
$handler = $manager->getAccessControlHandler($type);
$result = $handler->entityAccess($entity->getEventSeries(), $operation, $account, TRUE);
}
}
return $result;
}
}
<?php
namespace Drupal\group_recurring_events_series\Controller;
use Drupal\Core\Entity\EntityFormBuilderInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Render\RendererInterface;
use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Drupal\group\Entity\Controller\GroupContentController;
use Drupal\group\Entity\GroupInterface;
use Drupal\group\Plugin\GroupContentEnablerManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Returns responses for 'group_recurring_events_series' GroupContent routes.
*/
class GroupEventSeriesController extends GroupContentController {
/**
* The group content plugin manager.
*
* @var \Drupal\group\Plugin\GroupContentEnablerManagerInterface
*/
protected $pluginManager;
/**
* Constructs a new GroupEventSeriesController.
*
* @param \Drupal\group\Plugin\GroupContentEnablerManagerInterface $plugin_manager
* The group content plugin manager.
* @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The private store factory.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Entity\EntityFormBuilderInterface $entity_form_builder
* The entity form builder.
* @param \Drupal\Core\Render\RendererInterface $renderer
* The renderer.
*/
public function __construct(GroupContentEnablerManagerInterface $plugin_manager, PrivateTempStoreFactory $temp_store_factory, EntityTypeManagerInterface $entity_type_manager, EntityFormBuilderInterface $entity_form_builder, RendererInterface $renderer) {
parent::__construct($temp_store_factory, $entity_type_manager, $entity_form_builder, $renderer);
$this->pluginManager = $plugin_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('plugin.manager.group_content_enabler'),
$container->get('tempstore.private'),
$container->get('entity_type.manager'),
$container->get('entity.form_builder'),
$container->get('renderer')
);
}
/**
* {@inheritdoc}
*/
public function addPage(GroupInterface $group, $create_mode = FALSE) {
$build = parent::addPage($group, $create_mode);
// Do not interfere with redirects.
if (!is_array($build)) {
return $build;
}
// Overwrite the label and description for all of the displayed bundles.
$storage_handler = $this->entityTypeManager->getStorage('eventseries_type');
foreach ($this->addPageBundles($group, $create_mode) as $plugin_id => $bundle_name) {
if (!empty($build['#bundles'][$bundle_name])) {
$plugin = $group->getGroupType()->getContentPlugin($plugin_id);
$bundle_label = $storage_handler->load($plugin->getEntityBundle())->label();
$t_args = ['%eventseries_type' => $bundle_label];
$description = $create_mode
? $this->t('Add new content of type %eventseries_type to the group.', $t_args)
: $this->t('Add existing content of type %eventseries_type to the group.', $t_args);
$build['#bundles'][$bundle_name]['label'] = $bundle_label;
$build['#bundles'][$bundle_name]['description'] = $description;
}
}
return $build;
}
/**
* {@inheritdoc}
*/
protected function addPageBundles(GroupInterface $group, $create_mode) {
$bundles = [];
// Retrieve all group_recurring_events_series plugins for the group's type.
$plugin_ids = $this->pluginManager->getInstalledIds($group->getGroupType());
foreach ($plugin_ids as $key => $plugin_id) {
if (strpos($plugin_id, 'group_recurring_events_series:') !== 0) {
unset($plugin_ids[$key]);
}
}
// Retrieve all of the responsible group content types, keyed by plugin ID.
$storage = $this->entityTypeManager->getStorage('group_content_type');
$properties = [
'group_type' => $group->bundle(),
'content_plugin' => $plugin_ids,
];
foreach ($storage->loadByProperties($properties) as $bundle => $group_content_type) {
/** @var \Drupal\group\Entity\GroupContentTypeInterface $group_content_type */
$bundles[$group_content_type->getContentPluginId()] = $bundle;
}
return $bundles;
}
}
<?php
namespace Drupal\group_recurring_events_series\Plugin\GroupContentEnabler;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\group\Entity\GroupInterface;
use Drupal\group\Plugin\GroupContentEnablerBase;
use Drupal\recurring_events\Entity\EventSeriesType;
/**
* Provides a content enabler for event series.
*
* @GroupContentEnabler(
* id = "group_recurring_events_series",
* label = @Translation("Group event series"),
* description = @Translation("Adds event series to groups both publicly and privately."),
* entity_type_id = "eventseries",
* entity_access = TRUE,
* reference_label = @Translation("Title"),
* reference_description = @Translation("The title of the event series to add to the group"),
* deriver = "Drupal\group_recurring_events_series\Plugin\GroupContentEnabler\GroupEventSeriesDeriver",
* handlers = {
* "access" = "Drupal\group\Plugin\GroupContentAccessControlHandler",
* "permission_provider" = "Drupal\group_recurring_events_series\Plugin\GroupEventSeriesPermissionProvider",
* }
* )
*/
class GroupEventSeries extends GroupContentEnablerBase {
/**
* Retrieves the event series type this plugin supports.
*
* @return \Drupal\recurring_events\Entity\EventSeriesType
* The event series type this plugin supports.
*/
protected function getEventSeriesType() {
return EventSeriesType::load($this->getEntityBundle());
}
/**
* {@inheritdoc}
*/
public function getGroupOperations(GroupInterface $group) {
$account = \Drupal::currentUser();
$plugin_id = $this->getPluginId();
$type = $this->getEntityBundle();
$operations = [];
if ($group->hasPermission("create $plugin_id entity", $account)) {
$route_params = ['group' => $group->id(), 'plugin_id' => $plugin_id];
$operations["group_recurring_events_series-create-$type"] = [
'title' => $this->t('Add @type', ['@type' => $this->getEventSeriesType()->label()]),
'url' => new Url('entity.group_content.create_form', $route_params),
'weight' => 30,
];
}
return $operations;
}
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
$config = parent::defaultConfiguration();
$config['entity_cardinality'] = 1;
return $config;
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
// Disable the entity cardinality field as the functionality of this module
// relies on a cardinality of 1. We don't just hide it, though, to keep a UI
// that's consistent with other content enabler plugins.
$info = $this->t("This field has been disabled by the plugin to guarantee the functionality that's expected of it.");
$form['entity_cardinality']['#disabled'] = TRUE;
$form['entity_cardinality']['#description'] .= '<br /><em>' . $info . '</em>';
return $form;
}
/**
* {@inheritdoc}
*/
public function calculateDependencies() {
$dependencies = parent::calculateDependencies();
$dependencies['config'][] = 'recurring_events.eventseries_type.' . $this->getEntityBundle();
return $dependencies;
}
}
<?php
namespace Drupal\group_recurring_events_series\Plugin\GroupContentEnabler;
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\recurring_events\Entity\EventSeriesType;
/**
* Provides a deriver for group event series entities.
*/
class GroupEventSeriesDeriver extends DeriverBase {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives = [];
foreach (EventSeriesType::loadMultiple() as $name => $eventseries_type) {
$label = $eventseries_type->label();
$this->derivatives[$name] = [
'entity_bundle' => $name,
'label' => $this->t('Group event series (@type)', ['@type' => $label]),
'description' => $this->t('Adds %type content to groups both publicly and privately.', ['%type' => $label]),
] + $base_plugin_definition;
}
return $this->derivatives;
}
}
<?php
namespace Drupal\group_recurring_events_series\Plugin;
use Drupal\group\Plugin\GroupContentPermissionProvider;
/**
* Provides group permissions for events series GroupContent entities.
*/
class GroupEventSeriesPermissionProvider extends GroupContentPermissionProvider {
/**
* {@inheritdoc}
*/
public function getEntityViewUnpublishedPermission($scope = 'any') {
if ($scope === 'any') {
// Backwards compatible permission name for 'any' scope.
return "view unpublished $this->pluginId entity";
}
return parent::getEntityViewUnpublishedPermission($scope);
}
}
<?php
namespace Drupal\group_recurring_events_series\Routing;
use Drupal\recurring_events\Entity\EventSeriesType;
use Symfony\Component\Routing\Route;
/**
* Provides routes for group_recurring_events_series group content.
*/
class GroupEventSeriesRouteProvider {
/**
* Provides the shared collection route for group event series plugins.
*/
public function getRoutes() {
$routes = $plugin_ids = $permissions_add = $permissions_create = [];
foreach (EventSeriesType::loadMultiple() as $name => $eventseries_type) {
$plugin_id = "group_recurring_events_series:$name";
$plugin_ids[] = $plugin_id;
$permissions_add[] = "create $plugin_id content";
$permissions_create[] = "create $plugin_id entity";
}
// If there are no event series types yet, we cannot have any plugin IDs
// and should therefore exit early because we cannot have any routes for
// them either.
if (empty($plugin_ids)) {
return $routes;
}
$routes['entity.group_content.group_recurring_events_series_relate_page'] = new Route('group/{group}/eventseries/add');
$routes['entity.group_content.group_recurring_events_series_relate_page']
->setDefaults([
'_title' => 'Add existing content',
'_controller' => '\Drupal\group_recurring_events_series\Controller\GroupEventSeriesController::addPage',
])
->setRequirement('_group_permission', implode('+', $permissions_add))
->setRequirement('_group_installed_content', implode('+', $plugin_ids))
->setOption('_group_operation_route', TRUE);
$routes['entity.group_content.group_recurring_events_series_add_page'] = new Route('group/{group}/eventseries/create');
$routes['entity.group_content.group_recurring_events_series_add_page']
->setDefaults([
'_title' => 'Add new content',
'_controller' => '\Drupal\group_recurring_events_series\Controller\GroupEventSeriesController::addPage',
'create_mode' => TRUE,
])
->setRequirement('_group_permission', implode('+', $permissions_create))
->setRequirement('_group_installed_content', implode('+', $plugin_ids))
->setOption('_group_operation_route', TRUE);
return $routes;
}
}
recurring_events_ical.event_ical_mapping.*:
type: config_entity
label: 'Event iCal property mapping'
mapping:
id:
type: string
label: 'ID'
label:
type: label
label: 'Type'
properties:
type: sequence
label: 'Properties'
sequence:
type: recurring_events_ical.ical_property.[%key]
recurring_events_ical.ical_property.summary:
type: string
label: 'SUMMARY'
recurring_events_ical.ical_property.contact:
type: string
label: 'CONTACT'
nullable: true
recurring_events_ical.ical_property.description:
type: string
label: 'DESCRIPTION'
nullable: true
recurring_events_ical.ical_property.geo:
type: string
label: 'GEO'
nullable: true
recurring_events_ical.ical_property.location:
type: string
label: 'LOCATION'
nullable: true
recurring_events_ical.ical_property.priority:
type: string
label: 'PRIORITY'
nullable: true
recurring_events_ical.ical_property.url:
type: string
label: 'URL'
nullable: true
name: 'Recurring Events iCalendar'
type: module
description: 'Provides the ability to export recurring events as iCalendar files'
core_version_requirement: ^9.3 || ^10
package: 'Recurring Events'
configure: entity.event_ical_mapping.collection
dependencies:
- recurring_events:recurring_events
- token:token
entity.event_ical_mapping.add_form:
route_name: 'entity.event_ical_mapping.add_form'
title: 'Add iCalendar property mapping'
appears_on:
- entity.event_ical_mapping.collection
# iCal property mapping configuration page.
entity.event_ical_mapping.collection:
title: 'Event iCalendar Property Mapping'
description: 'Configure event instance tokens to populate iCalendar properties.'
route_name: entity.event_ical_mapping.collection
parent: events.admin.overview
weight: 4
<?php
/**
* @file
* Contains recurring_events_ical.module.
*/
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_entity_base_field_info_alter().
*/
function recurring_events_ical_entity_base_field_info_alter(&$fields, EntityTypeInterface $entity_type) {
if ($entity_type->id() === 'eventseries' || $entity_type->id() === 'eventinstance') {
$fields['event_ical_link'] = BaseFieldDefinition::create('event_ical_link')
->setName('event_ical_link')
->setLabel(t('Event iCalendar Link'))
->setComputed(TRUE)
->setClass('\Drupal\recurring_events_ical\Field\EventICalLinkItemList')
->setTargetEntityTypeId($entity_type->id())
->setDisplayConfigurable('form', FALSE)
->setDisplayConfigurable('view', TRUE)
->setDisplayOptions('view', [
'label' => 'hidden',
'weight' => 10,
]);
}
}
/**
* Implements hook_entity_type_alter().
*/
function recurring_events_ical_entity_type_alter(array &$entity_types) {
/** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */
$entity_types['eventseries']->setLinkTemplate('ical', $entity_types['eventseries']->getLinkTemplate('canonical') . '/ical');
$entity_types['eventinstance']->setLinkTemplate('ical', $entity_types['eventinstance']->getLinkTemplate('canonical') . '/ical');
}
/**
* Implements hook_config_schema_info_alter().
*/
function recurring_events_ical_config_schema_info_alter(&$definitions) {
foreach (['eventseries', 'eventinstance'] as $entity_type) {
$definitions["recurring_events.$entity_type.config"]['mapping']['ical_link_title'] = [
'type' => 'string',
'label' => 'iCalendar link title',
];
}
}
/**
* Implements hook_form_FORM_ID_alter() for 'eventseries_settings'.
*/
function recurring_events_ical_form_eventseries_settings_alter(&$form, FormStateInterface $form_state, $form_id) {
_recurring_events_ical_settings($form, 'eventseries');
$form['#submit'][] = 'recurring_events_ical_form_eventseries_settings_submit';
}
/**
* Implements hook_form_FORM_ID_alter() for 'eventinstance_settings'.
*/
function recurring_events_ical_form_eventinstance_settings_alter(&$form, FormStateInterface $form_state, $form_id) {
_recurring_events_ical_settings($form, 'eventinstance');
$form['#submit'][] = 'recurring_events_ical_form_eventinstance_settings_submit';
}
/**
* Helper function to add the iCalendar settings fields to a form.
*
* @param array &$form
* Nested array of form elements that comprise the form.
* @param string $entity_type
* The type of event entity, either 'eventseries' or 'eventinstance'.
*/
function _recurring_events_ical_settings(array &$form, string $entity_type) {
$config = \Drupal::config("recurring_events.$entity_type.config");
/** @var \Drupal\token\TokenEntityMapperInterface $token_entity_mapper */
$token_entity_mapper = \Drupal::service('token.entity_mapper');
$token_types[$entity_type] = $token_entity_mapper->getTokenTypeForEntityType($entity_type);
$form['ical'] = [
'#type' => 'details',
'#title' => t('iCalendar'),
'#open' => TRUE,
];
$form['ical']['ical_link_title'] = [
'#type' => 'textfield',
'#title' => t('iCalendar Link Title'),
'#description' => t('Link text for the Event iCalendar Link field.'),
'#size' => 65,
'#maxlength' => 1280,
'#element_validate' => ['token_element_validate'],
'#after_build' => ['token_element_validate'],
'#token_types' => $token_types,
'#default_value' => $config->get('ical_link_title') ?? t('Download as iCal'),
];
$form['ical']['token_browser'] = [
'#theme' => 'token_tree_link',
'#token_types' => $token_types,
'#global_types' => TRUE,
'#show_nested' => TRUE,
];
}
/**
* Additional submission handler for the eventseries_settings form.
*
* @param array &$form
* Nested array of form elements that comprise the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*/
function recurring_events_ical_form_eventseries_settings_submit(array &$form, FormStateInterface $form_state) {
\Drupal::configFactory()->getEditable('recurring_events.eventseries.config')
->set('ical_link_title', $form_state->getValue('ical_link_title'))
->save();
}
/**
* Additional submission handler for the eventinstance_settings form.
*
* @param array &$form
* Nested array of form elements that comprise the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state.
*/
function recurring_events_ical_form_eventinstance_settings_submit(array &$form, FormStateInterface $form_state) {
\Drupal::configFactory()->getEditable('recurring_events.eventinstance.config')
->set('ical_link_title', $form_state->getValue('ical_link_title'))
->save();
}
# iCal property mapping configuration
entity.event_ical_mapping.collection:
path: '/admin/structure/events/ical'
defaults:
_entity_list: 'event_ical_mapping'
_title: 'iCalendar'
requirements:
_permission: 'administer eventinstance types'
entity.event_ical_mapping.add_form:
path: '/admin/structure/events/ical/add'
defaults:
_entity_form: 'event_ical_mapping.add'
_title: 'Add iCalendar property mapping'
requirements:
_permission: 'administer eventinstance types'
entity.event_ical_mapping.edit_form:
path: '/admin/structure/events/ical/{event_ical_mapping}'
defaults:
_entity_form: 'event_ical_mapping.edit'
_title: 'Edit iCalendar property mapping'
requirements:
_permission: 'administer eventinstance types'
entity.event_ical_mapping.delete_form:
path: '/admin/structure/events/ical/{event_ical_mapping}/delete'
defaults:
_entity_form: 'event_ical_mapping.delete'
_title: 'Delete iCalendar property mapping'
requirements:
_permission: 'administer eventinstance types'
# iCalendar download on EventSeries
entity.eventseries.ical:
path: '/events/series/{eventseries}/ical'
defaults:
_controller: '\Drupal\recurring_events_ical\Controller\EventExportController::series'
requirements:
_entity_access: 'eventseries.view'
eventseries: \d+
options:
parameters:
eventseries:
type: entity:eventseries
# iCalendar download on EventInstance
entity.eventinstance.ical:
path: '/events/{eventinstance}/ical'
defaults:
_controller: '\Drupal\recurring_events_ical\Controller\EventExportController::instance'
requirements:
_entity_access: 'eventinstance.view'
eventinstance: \d+
options:
parameters:
eventinstance:
type: entity:eventinstance