function _drush_format_help_subsection

8.0.x help.drush.inc _drush_format_help_subsection($command, $section, $subsection, $formatter, $prefix = ' ')
6.x help.drush.inc _drush_format_help_subsection($command, $section, $subsection, $formatter, $prefix = ' ')
7.x help.drush.inc _drush_format_help_subsection($command, $section, $subsection, $formatter, $prefix = ' ')
4.x drush.inc _drush_format_help_subsection($command, $section, $subsection, $formatter, $prefix = ' ')
5.x help.drush.inc _drush_format_help_subsection($command, $section, $subsection, $formatter, $prefix = ' ')
master helpsingle.drush.inc _drush_format_help_subsection($command, $section, $subsection, $formatter, $prefix = ' ')

Format one named portion of a subsection from a command record. Subsections allow related parts of a help record to be grouped together. For example, in the 'options' section, sub-options that are related to a particular primary option are stored in a 'sub-options' section whose name == the name of the primary option.

@returns array Formatted rows, suitable for printing via drush_print_table.

Parameters

$command: A command record with help information

$section: The name of the section to format ('options', 'topic', etc.)

$subsection: The name of the subsection (e.g. the name of the primary option)

$formatter: The name of a function to use to format the rows of the subsection

$prefix: Characters to prefix to the front of the label (for indentation)

1 call to _drush_format_help_subsection()
drush_format_help_section in commands/core/help.drush.inc
Format one named help section from a command record

File

commands/core/help.drush.inc, line 167

Code

function _drush_format_help_subsection($command, $section, $subsection, $formatter, $prefix = '  ') {
  foreach ($command['sub-' . $section][$subsection] as $name => $help_attributes) {
    if (!is_array($help_attributes)) {
      $help_attributes = array('description' => $help_attributes);
    }
    $help_attributes['label'] = $name;
    call_user_func_array($formatter, array($command, &$help_attributes));
    if (!array_key_exists('hidden', $help_attributes)) {
      $rows[] = array($prefix . $help_attributes['label'], $help_attributes['description']);
      // Process the subsections too, if any
      if (!empty($command['sub-' . $section]) && array_key_exists($name, $command['sub-' . $section])) {
        $rows = array_merge($rows, _drush_format_help_subsection($command, $section, $name, $formatter, $prefix . '  '));
      }
    }
  }
  return $rows;
}