function ajax_links_api_get_triggers in Ajaxify Drupal with JQuery Ajax 7
Same name and namespace in other branches
- 6 ajax_links_api.module \ajax_links_api_get_triggers()
Get trigger classes/ids.
Ajax links triggers now come in two varieties:
positive triggers: these are selectors that are used to select a set of links negative triggers: these are selectors used in .not() to remove links from the set of matched ones
The user can specify these in the admin/config screen. Negative triggers are those listed with a "!" as the first character.
1 call to ajax_links_api_get_triggers()
- ajax_links_api_init in ./
ajax_links_api.module - Implements hook_init().
File
- ./
ajax_links_api.module, line 241 - Make any links or create new links to load content to particular DIV via jQuery Ajax.
Code
function ajax_links_api_get_triggers() {
$trigger = variable_get('ajax_links_api_trigger', '.ajax-link' . "\n");
$trigger = explode("\n", $trigger);
// trim all entries
$trigger = array_map('trim', $trigger);
// filter out empty lines
$trigger = array_filter($trigger);
$positive_triggers = array();
$negative_triggers = array();
foreach ($trigger as $this_trigger) {
if (preg_match('/^!/', $this_trigger)) {
$negative_triggers[] = substr($this_trigger, 1);
}
else {
$positive_triggers[] = $this_trigger;
}
}
$positive_trigger = implode(',', $positive_triggers);
$negative_trigger = implode(',', $negative_triggers);
return array(
$positive_trigger,
$negative_trigger,
);
}