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, bool $recursive = false, bool $getBody = false);

Arguments

NameType(s)Description
$classstring
$recursive (optional)bool

Recurse into sub-chapters?

$getBody (optional)bool

Also return body of chapters?

Return value

array


WireApiDocs methods and properties

API reference based on ProcessWire core version 3.0.264