function drush_format_help_section

8.0.x help.drush.inc drush_format_help_section($command, $section)
6.x help.drush.inc drush_format_help_section($command, $section)
7.x help.drush.inc drush_format_help_section($command, $section)
4.x drush.inc drush_format_help_section($command, $section)
5.x help.drush.inc drush_format_help_section($command, $section)
master helpsingle.drush.inc drush_format_help_section($command, $section)

Format one named help section from a command record

@returns array Formatted rows, suitable for printing via drush_print_table. The returned array can be empty.

Parameters

$command: A command record with help information

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

3 calls to drush_format_help_section()
drush_core_global_options in commands/core/core.drush.inc
drush_help_html_global_options in commands/core/help.drush.inc
drush_print_help in commands/core/help.drush.inc
Print the help for a single command to the screen.

File

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

Code

function drush_format_help_section($command, $section) {
  $rows = array();
  $formatter = (function_exists('drush_help_section_formatter_' . $section)) ? 'drush_help_section_formatter_' . $section : 'drush_help_section_default_formatter';
  foreach ($command[$section] 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 (empty($help_attributes['hidden'])) {
      $rows[] = array(
        'label' => $help_attributes['label'],
        'description' => $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));
      }
    }
  }
  return $rows;
}