Skip to content

Instantly share code, notes, and snippets.

@hertsch
Last active December 21, 2015 10:09
Show Gist options
  • Save hertsch/6289857 to your computer and use it in GitHub Desktop.
Save hertsch/6289857 to your computer and use it in GitHub Desktop.

~~ event ~~

Introduction

For a general help to the kitCommands, the usage and the general available parameters please refer the kitCommand help.

Parameters

###action[]

Tells Event the action to perform, supported are:

  • config - enable to set specific values in the configuration file, see parameter set[] for more information
  • event - show a event specified by id[]. action[event] is also used to prepare a page a target for permanent links
  • list - will show a list of events. Use the filter[] parameter to select the events which will be shown.
  • propose - enable the visitor to propose a new event
  • search - show a search dialog and enable the visitor to search for a event

Sample:

~~ event ... action[propose] ~~

###captcha[]

Supported dialog: Subscribe.

If the reCaptcha service is enabled you can temporarily switch of the captcha for the supported dialog:

~~ event ... captcha[0] ~~

or

~~ event ... captcha[false] ~~

will disable the reCaptcha.

comments_info[]

At action[list] (showing a list of event) you can specify the parameter comments_info[]

~~ event action[list] ... comments_info[true] ~~

to count and show the comments for the events shown in the result event list. Within the template you can access the counter with

{% if parameter.comments_info %}
  {{ event.comments.count }}
{% endif %}

comments_type[]

Optional parameter in combination with comments_info[]. By default you will use the kitCommand for the Comments like this

~~ comments type[EVENT] id[EVENT_ID] ~~

and define the comment type as EVENT. If you have defined another comment type, you can use comments_type[] to specify the comment type you have defined.

filter[]

The filter[] parameter is mighty and enable you to filter all events for different aspects. You can specify one or more key => value pairs within the filter, separate them with a pipe |. Supported are the following keys:

  • actual - filter the actual events. You can use this filter with only one value, which can be current (for the current date) or a digit which will be add to the actual date or subtract from the actual date. In this case the filter return all events from this date up to 14 days ahead. Sample: actual=current (from today up to 14 days ahead), actual=-1 (from yesterday up to 14 days ahead). You can also use this filter with two values, separated by comma. In this case the first value indicate the start and the second the end. Start can be current (for the current date) or a digit which will be add or subtract to/from the actual date. End can be week (for all events until the end of the week) or month (until end of month) or (year until end of the year) or a positive integer which count the days ahead from the Start for the filter. Sample: actual=current,7 (from today up to 7 days), actual=-7,14 (one week back and one week ahead), actual=current,month (from today until the end of the month)
  • area - filter the events by the given local area, i.e. if you have specified locations for Berlin, i.e. the local area Kreuzberg, you can filter them with area=Kreuzberg. You can specify multiple areas, separate them by comma: area=Kreuzberg,Wedding will filter the areas Kreuzberg and Wedding.
  • city - you can filter for the cities, where the event is located. city=Berlin will find all locations in cities beginning with Berlin, for example Berlin, but also Berlin Charlottenburg or Berlin-Zehlendorf. You can specify multiple cities, just separate them by comma: city=Berlin,Bad will filter all cities starting with Berlin and Bad.
  • country - no default. You can filter the location using the country code, country=at will filter for all events with location in Austria
  • day - a digit from 1 to 31 or current (for the current day). If day is a digit and not specified the key month and/or year this filter will use the current month and year. If day is specified, month and year will be used but not executed as separate filter. day will return all events for this day.
  • group - you filter the events by one or more Event group. group=Veranstaltungen will filter all events of the group Veranstaltungen, group=Theater,Konzert will filter all events of the groups Theater or Konzert.
  • limit - by default the filter will return all hits, you can limit the hits: limit=10 will return at maximum 10 events
  • mode - the default mode is mode=duration, the filter will return events which start within the given date or are still active. mode=strict will only return events which start within the given date.
  • month - a digit from 1 to 12 or current (for the current month). If month is a digit and not specified the year this filter will use the current year. If year is specified it will be used but not executed as separate filter. month will return all events from the beginning until the end of the month.
  • order_by - by default the filter order the results by the field event_date_from. You can specify other fields and you can also specify multiple fields, separated by comma, please refer the Event API for further information
  • order_direction - by default the filter order the order_by field in ascending order. You can specify order_direction=DESC for descending order. Allowed values are ASC (ascending) or DESC (descending)
  • publish - by default the filter return only events where the publish from and publish to dates fit to the given date. With publish=ignore the filter will ignore all publishing settings
  • state - filter the events by the given state, i.e. if you have specified the states Bayern and Baden-Württemberg, you can filter them with state=Bayern for Bayern. You can specify multiple areas, separate them by comma: state=Bayern,Baden-Württemberg will filter the states Bayern and Baden-Württemberg.
  • status - by default the filter will only search for events with the status ACTIVE. You can specify the status ACTIVE, LOCKED or DELETED
  • year - a digit between 1 and 99 (will become 2001 up to 2099) or a digit greater 1900 or current (for the current year). day and month are ignored, the filter will return all events of the year
  • zip - you can filter for the complete or a part of zip codes. zip=01 will search for all locations with zips starting at 01. You can also filter for multiple zip codes, just separate them by comma: zip=13,151 will filter for zips starting with 13 or 151. If you want the filter all zips starting with 0 you must use the keyword null instead 0 because the filter can not recognize a single 0: zip=null will search for all locations starting at 0 for you.

Example

~~ Event ... filter[day=current] ~~

will return all events which start today or started in the past and still active.

~~ Event ... filter[day=current|mode=strict] ~~

will return all events which start today (but not the events which started in the past and still active)

~~ Event ... filter[day=15|month=5] ~~

will return all events which are active at may, 15 of the current year.

group[]

Select the Event group, the parameter action[search] or action[propose] depends on:

~~ Event ... group[concert] ~~

Select the group with the name concert.

You can specify more than one group, just separate them by comma:

~~ Event ... group[concert,theater] ~~

will select groups concert and theater.

id[]

Specify the identifier (ID) of a event to show it.

~~ Event ... id[10] ~~

will show the event with the ID 10.

link[]

With the parameter link[] you control the available links within the dialog.

Possible values are:

  • detail - link to the detailed information of the event
  • ical - add a link to a *.ics file with iCal information for import in programs like Outlook. To use this feature the iCal creation must be enabled in the event.config.json.
  • map - if the location address is available, link to a Google Map which show the location.
  • permanent - a permanent and unique link to the event. To make use of permanent links you must specify the target URL in the event.config.json.
  • subscribe - link to subscribe to the event

The values can be used standalone or combined in any sequence, just separate them by comma:

~~ event ... link[detail] ~~

will show a link to the detailed information,

~~ event ... link[map,detail] ~~

will show a link to a Google Map and to the detail page.

map[]

If possible, show a embedded Google Map corresponding to the given location address:

~~ event ... map[] ~~

this parameter does not support additional values.

mode[]

This is a additional (optional) parameter for action[propose], possible values are:

  • mode[full] - (default) ask the proposer for all available data fields
  • mode[simple] - reduce the asked fields to the minimum

Example:

~~ event action[propose] mode[simple] ~~

will reduce the asked fields to the minimum.

rating[]

By default a rating is enabled for all events. The general behavior of the rating is configured in the config.event.json, you can switch off the rating for a Event or a Event List using the parameter rating[]:

~~ event ... rating[false] ~~

or

~~ event ... rating[0] ~~

will disable the rating.

set[]

In combination with action[config] you can use set[] to set a specific configuration value. Supported are the following keys:

  • permalink - use set[permalink=<URL>] where <URL> is the complete URL to the page in the CMS which should be used as permanent link address for Event

view[]

In combination with action[view] you can use the parameter view[] to define the type of view for the event. Possible values are:

  • view[custom] - show a customized view of the event, use template /command/item/event.custom.twig
  • view[detail] - show detailed information for the event, use template /command/item/event.detail.twig
  • view[recurring] - if the event is recurring, show the parent event and the next upcoming recurring events to subscribe, use template /command/item/event.recurring.twig
  • view[small] - (default) show a small view for the event, use template /command/item/event.small.twig

Example:

~~ event action[event] id[4] view[detail] ~~

will show a detailed information for the event with the ID 4.

I'm the welcome file!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment