WireApiDocs::getChapters()

Get chapters for one class

If given just a $class it returns a plain PHP array of chapter titles like this:

If $recursive is true, then it returns this:

If $getBody is true then the return value is like the above except that there is also a body key along every title that contains the body text of the chapter.

Examples

[ 
  0 => 'H2 Chapter title',
  1 => 'Another H2 chapter title',
  ...
],
[
  [
    'title' => 'H2 Chapter title',
    'chapters' => [
      [
        'title' => 'H3 Chapter title',
        'chapters' => [],
      ],
      [
        'title' => 'Another H3 Chapter title',
        'chapters' => [],
      ],
    ],
  ],
  [
    'title' => 'Another H2 chapter title',
    'chapters' => [],
  ],
]

Usage

// basic usage
$array = $wireApiDocs->getChapters(string $class);

// usage with all arguments
$array = $wireApiDocs->getChapters(string $class, array $options = []);

Arguments

NameType(s)Description
$classstring
$options (optional)array
  • recursive (bool): Recurse into sub-chapters?
  • getBody (bool): Also return body of chapters?
  • getFlat (bool): Get in flat array?
  • getString (bool): Get as string rather than array?

Return value

array


WireApiDocs methods and properties

API reference based on ProcessWire core version 3.0.267