You are here

function _cookie_content_blocker_event_form in Cookie Content Blocker 7

Create form elements for JavaScript events.

Parameters

array $defaults: The defaults for the elements.

Return value

mixed The form elements structure.

1 call to _cookie_content_blocker_event_form()
_cookie_content_blocker_cookie_aware_form in ./cookie_content_blocker.admin.inc
Add cookie awareness settings to the form.

File

./cookie_content_blocker.admin.inc, line 144
Admin functionality for Cookie content blocker.

Code

function _cookie_content_blocker_event_form(array $defaults) {
  $elements['name'] = array(
    '#type' => 'textfield',
    '#title' => t('JavaScript event name'),
    '#description' => t('The event for the element selected below.'),
    '#default_value' => $defaults['name'],
    '#element_validate' => array(
      '_cookie_content_blocker_element_validate_cleanup_value',
    ),
  );
  $elements['selector'] = array(
    '#type' => 'textfield',
    '#title' => t('JavaScript event DOM element selector'),
    '#description' => t("The jQuery selector of the DOM element the above event is associated with, omit the jQuery('') or \$('') part. E.g. 'window' or '.some-class > .other-child-class' (without quotes)."),
    '#default_value' => $defaults['selector'],
    '#element_validate' => array(
      '_cookie_content_blocker_element_validate_cleanup_value',
    ),
  );
  return $elements;
}