HowToNotificationsTags

Datas are computed in getDatasForTemplate and Tags are define in getTags.
Datas defined must have an entry in getTags for list tag generation.

2 types of tags are available : lang, value. lang ones may be auto generated based on tags definitions.
The following code at the end of getDataForTemplate permit to auto add lang tags to computed tags

      $this->getTags();
      foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) {
         if (!isset($this->datas[$tag])) {
            $this->datas[$tag] = $values['label'];
         }
      }

getTags function include addTagToList directives to add tags. Few examples below.
Each tag may be available for specifics events or for all Event. The events parameter of addTagToList permit to define it.
NotificationTarget::TAG_FOR_ALL_EVENTS permit to set it for all events.

  • Adding a value and its associated lang for all events :
    $this->addTagToList(array('tag'    => 'tagname',
                              'label'  => 'tagdescription',
                              'value'  => true,
                              'lang'   => true,
                              'events' => NotificationTarget::TAG_FOR_ALL_EVENTS));
    
    • it produces for all events :
      • ##tagname## : the tag value computed in getDataForTemplate
      • ##lang.tagname## : the associated lang tag. This tag value is tagdescription
  • Adding a value and without associated lang for a specific event :
    $this->addTagToList(array('tag'    => 'tagname',
                                       'label'  => 'tagdescription',
                                       'value'  => true,
                                       'lang'   => false,
                                       'events' => array('alertnotclosed'));
    
    • it produces for the event alertnotclosed :
      • ##tagname## : the tag value computed in getDataForTemplate
  • Adding only a lang tag for all events :
    $this->addTagToList(array('tag'    => 'tagname',
                              'label'  => 'tagdescription',
                              'value'  => false,
                              'lang'   => true,
                              'events' => NotificationTarget::TAG_FOR_ALL_EVENTS));
    
    • it produces for all events :
      • ##lang.tagname## : the associated lang tag. This tag value is tagdescription
  • Adding a value and its associated lang for all events defining allowed values for it:
    $this->addTagToList(array('tag'    => 'tagname',
                              'label'  => 'tagdescription',
                              'value'  => true,
                              'lang'   => true,
                              'events' => NotificationTarget::TAG_FOR_ALL_EVENTS,
                              'allowed_values' => array('value1','value2','value3','value4')
    ));
    
    • it produces for all events :
      • ##tagname## : the tag value computed in getDataForTemplate
      • ##lang.tagname## : the associated lang tag. This tag value is tagdescription
      • it also show the allowed values in available tags list
  • Adding a foreach tag for all events. This tag permit to use a FOREACH condition in templates.
    $this->addTagToList(array('tag'    => 'tagname',
                              'label'  => 'tagdescription',
                              'foreach'   => true,
                              'events' => NotificationTarget::TAG_FOR_ALL_EVENTS));
    
    • it produces for all events :
      • ##FOREACHlinkedtickets## ##ENDFOREACHlinkedtickets## : The foreach loop