function advanced_help_get_topic_hierarchy

cis7 advanced_help.module advanced_help_get_topic_hierarchy(&$topics)
cle7 advanced_help.module advanced_help_get_topic_hierarchy(&$topics)
elmsmedia7 advanced_help.module advanced_help_get_topic_hierarchy(&$topics)
icor7 advanced_help.module advanced_help_get_topic_hierarchy(&$topics)
meedjum_blog7 advanced_help.module advanced_help_get_topic_hierarchy(&$topics)
mooc7 advanced_help.module advanced_help_get_topic_hierarchy(&$topics)

Build a hierarchy for a single module's topics.

2 calls to advanced_help_get_topic_hierarchy()
advanced_help_index_page in sites/all/modules/ulmus/advanced_help/advanced_help.module
Page callback to view the advanced help topic index.
advanced_help_view_topic in sites/all/modules/ulmus/advanced_help/advanced_help.module
Load and render a help topic.

File

sites/all/modules/ulmus/advanced_help/advanced_help.module, line 279
Pluggable system to provide advanced help facilities for Drupal and modules.

Code

function advanced_help_get_topic_hierarchy(&$topics) {
  foreach ($topics as $module => $module_topics) {
    foreach ($module_topics as $topic => $info) {
      $parent_module = $module;
      // We have a blank topic that we don't want parented to itself.
      if (!$topic) {
        continue;
      }

      if (empty($info['parent'])) {
        $parent = '';
      }
      elseif (strpos($info['parent'], '%')) {
        list($parent_module, $parent) = explode('%', $info['parent']);
        if (empty($topics[$parent_module][$parent])) {
          // If it doesn't exist, top level.
          $parent = '';
        }
      }
      else {
        $parent = $info['parent'];
        if (empty($module_topics[$parent])) {
          // If it doesn't exist, top level.
          $parent = '';
        }
      }

      if (!isset($topics[$parent_module][$parent]['children'])) {
        $topics[$parent_module][$parent]['children'] = array();
      }
      $topics[$parent_module][$parent]['children'][] = array($module, $topic);
      $topics[$module][$topic]['_parent'] = array($parent_module, $parent);
    }
  }
}