Simple ICS
Categories
Component ID
2862948
Component name
Simple ICS
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Downloads
321
Component created
Component changed
Component body
* Introduction
This is a simple module which allows create simple twig urls which will create an ICS calendar file based on a node and two start and end date fields.
* Requirements
This module requires the https://github.com/markuspoerschke/iCal module which is part of the composer.json file included
* Recommended modules
N/A
* Installation
Typical Drupal install
* Configuration
- Create an ICAL file by calling simple_ics_build_ical(), this returns file fid
- Pass the fid through a preprocess to pass the fid to a twig template. Good example of this is:
- Create a url through a twig template by using the dynamic ical fid
- Place twig url in template to be rendered
- Have a beer, you are done!
/**
*
* Implements hook_preprocess_node().
*/
function hook_preprocess_node(&$variables) {
if ($variables['node']->bundle() === 'event') {
$variables['start_date_field'] = $variables['node']->field_event_start_date->getName();
$variables['end_date_field'] = $variables['node']->field_event_end_date->getName();
$variables['nid'] = $variables['node']->id();
}
}
<a href="/simple_ics/{{ nid }}/{{ start_date_field }}/{{ end_date_field }}">Add to My Calendar</a>
* Troubleshooting
* FAQ
* Maintainers
Daniel McDermott -> generalconsensus
