structure($data, $page = null, $key = null)

Creates a Kirby structure object from a data array

  • $data (array)
  • $page (Page)
    Optional, defaults to the current page
  • $key (string)
    Field key for the page object
  • return ($structure)

Example

$structure = structure(array(
    array(
        'name' => 'Apple',
        'type' => 'fruit'
    ),
    array(
        'name' => 'Banana',
        'type' => 'fruit'
    ),
    array(
        'name' => 'Salad',
        'type' => 'vegetable'
    )
), $page, 'food');

Is something missing or incorrect? Edit this page on Github…