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

  1. Create an ICAL file by calling simple_ics_build_ical(), this returns file fid
  2. Pass the fid through a preprocess to pass the fid to a twig template. Good example of this is:
  3. /**
     *
     * 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();
      }
    }
    
    
    
  4. Create a url through a twig template by using the dynamic ical fid
  5.         <a href="/simple_ics/{{ nid }}/{{ start_date_field }}/{{ end_date_field }}">Add to My Calendar</a>
    
    
  6. Place twig url in template to be rendered
  7. Have a beer, you are done!

* Troubleshooting

* FAQ

* Maintainers
Daniel McDermott -> generalconsensus