You are here

function activeedit_get_targets in Javascript Tools 5

6 calls to activeedit_get_targets()
activeedit_footer in activeedit/activeedit.module
Implementation of hook_footer().
activeedit_form_alter in activeedit/activeedit.module
Implementation of hook_form_alter().
activeedit_node_data_form in activeedit/modules/node.inc
Encode data on nodes for reference by Javascript.
activeedit_node_form_id in activeedit/modules/node.inc
Change the form id to 'node_form' if this is a node form.
activeedit_render in activeedit/activeedit.module

... See full list

File

activeedit/activeedit.module, line 143

Code

function activeedit_get_targets($type, $prepare = FALSE, $flatten = FALSE, $object = NULL) {
  $settings = activeedit_types($type);
  $targets = array();
  foreach (module_implements('activeedit_' . $type) as $module) {
    $targets = array_merge_recursive($targets, module_invoke($module, 'activeedit_' . $type, $object));
  }

  // Test for access.
  foreach (array_keys($targets) as $key) {
    if (!element_children($targets[$key]) && !$targets[$key]['#access']) {
      unset($targets[$key]);
    }
  }
  if ($prepare) {
    $selectors = jstools_theme_data('activeedit');
    _activeedit_prepare($targets, $selectors, $settings);
  }
  if ($flatten) {
    foreach (element_children($targets) as $key) {
      foreach (element_children($targets[$key]) as $child) {
        $targets[$child] = $targets[$key][$child];
        unset($targets[$key][$child]);
      }
    }
  }
  return $targets;
}