Task/Collect/HooksCollector7.php
private function getHookDestinations(&$hook_files) {
    // Get our data.
    $data = $this->getHookInfo();

    // Incoming data is destination key, array of hooks.
    // (Because it makes typing the data out easier! Computers can just adapt.)
    foreach ($data as $module => $module_data) {
      // The key in $hook_files we correspond to
      // @todo, possibly: this feels like slightly shaky ground.
      $filename = "$module.api.php";

      // Skip filenames we haven't already found, so we don't pollute our data
      // array with hook destination data for files that don't exist here.
      if (!isset($hook_files[$filename])) {
        continue;
      }

      // The module data can set a single destination for all its hooks.
      if (isset($module_data['destination'])) {
        $hook_files[$filename]['destination'] = $module_data['destination'];
      }
      // It can also (or instead) set a destination per hook.
      if (isset($module_data['hook_destinations'])) {
        $hook_files[$filename]['hook_destinations'] = array();
        foreach ($module_data['hook_destinations'] as $destination => $hooks) {
          $destinations[$module] = array_fill_keys($hooks, $destination);
          $hook_files[$filename]['hook_destinations'] += array_fill_keys($hooks, $destination);
        }
      }

      // Add the dependencies array as it comes; it will be processed per hook later.
      if (isset($module_data['hook_dependencies'])) {
        $hook_files[$filename]['hook_dependencies'] = $module_data['hook_dependencies'];
      }
    }

    //print_r($hook_files);
  }
private function getHookDestinations(&$hook_files) {
    // Get our data.
    $data = $this->getHookInfo();

    // Incoming data is destination key, array of hooks.
    // (Because it makes typing the data out easier! Computers can just adapt.)
    foreach ($data as $module => $module_data) {
      // The key in $hook_files we correspond to
      // @todo, possibly: this feels like slightly shaky ground.
      $filename = "$module.api.php";

      // Skip filenames we haven't already found, so we don't pollute our data
      // array with hook destination data for files that don't exist here.
      if (!isset($hook_files[$filename])) {
        continue;
      }

      // The module data can set a single destination for all its hooks.
      if (isset($module_data['destination'])) {
        $hook_files[$filename]['destination'] = $module_data['destination'];
      }
      // It can also (or instead) set a destination per hook.
      if (isset($module_data['hook_destinations'])) {
        $hook_files[$filename]['hook_destinations'] = array();
        foreach ($module_data['hook_destinations'] as $destination => $hooks) {
          $destinations[$module] = array_fill_keys($hooks, $destination);
          $hook_files[$filename]['hook_destinations'] += array_fill_keys($hooks, $destination);
        }
      }

      // Add the dependencies array as it comes; it will be processed per hook later.
      if (isset($module_data['hook_dependencies'])) {
        $hook_files[$filename]['hook_dependencies'] = $module_data['hook_dependencies'];
      }
    }

    //print_r($hook_files);
  }
private function getHookDestinations ( & $ hook_files ) { // Get our data. $ data = $ this -> getHookInfo ( ) ; // Incoming data is destination key, array of hooks. // (Because it makes typing the data out easier! Computers can just adapt.) foreach ( $ data as $ module => $ module_data ) { // The key in $hook_files we correspond to // @todo, possibly: this feels like slightly shaky ground. $ filename = "$module.api.php" ; // Skip filenames we haven't already found, so we don't pollute our data // array with hook destination data for files that don't exist here. if ( ! isset ( $ hook_files [ $ filename ] ) ) { continue ; } // The module data can set a single destination for all its hooks. if ( isset ( $ module_data [ 'destination' ] ) ) { $ hook_files [ $ filename ] [ 'destination' ] = $ module_data [ 'destination' ] ; } // It can also (or instead) set a destination per hook. if ( isset ( $ module_data [ 'hook_destinations' ] ) ) { $ hook_files [ $ filename ] [ 'hook_destinations' ] = array ( ) ; foreach ( $ module_data [ 'hook_destinations' ] as $ destination => $ hooks ) { $ destinations [ $ module ] = array_fill_keys ( $ hooks , $ destination ) ; $ hook_files [ $ filename ] [ 'hook_destinations' ] += array_fill_keys ( $ hooks , $ destination ) ; } } // Add the dependencies array as it comes; it will be processed per hook later. if ( isset ( $ module_data [ 'hook_dependencies' ] ) ) { $ hook_files [ $ filename ] [ 'hook_dependencies' ] = $ module_data [ 'hook_dependencies' ] ; } } //print_r($hook_files); }
Add extra data about hook destinations to the hook file data.

This allows entire files or individual hooks to have a file other than
the default %module.module as their destination.
Add extra data about hook destinations to the hook file data .