You are here

class Fixtures in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/tabledrag_example/src/Fixtures.php \Drupal\tabledrag_example\Fixtures

Provides sample data for module's examples.

Hierarchy

  • class \Drupal\tabledrag_example\Fixtures

Expanded class hierarchy of Fixtures

2 files declare their use of Fixtures
TableDragExampleResetForm.php in tabledrag_example/src/Form/TableDragExampleResetForm.php
tabledrag_example.install in tabledrag_example/tabledrag_example.install
Install and uninstall functions for the tabledrag example module.

File

tabledrag_example/src/Fixtures.php, line 8

Namespace

Drupal\tabledrag_example
View source
class Fixtures {

  /**
   * Returns array of sample records for demo purposes.
   *
   * @return array
   *   Array of sample records.
   *
   * @see \Drupal\tabledrag_example\Form\TableDragExampleResetForm::submitForm()
   * @see tabledrag_example_install()
   */
  public static function getSampleItems() {
    return [
      [
        'name' => 'Item One',
        'description' => 'The first item',
        'itemgroup' => 'Group1',
      ],
      [
        'name' => 'Item Two',
        'description' => 'The second item',
        'itemgroup' => 'Group1',
      ],
      [
        'name' => 'Item Three',
        'description' => 'The third item',
        'itemgroup' => 'Group1',
      ],
      [
        'name' => 'Item Four',
        'description' => 'The fourth item',
        'itemgroup' => 'Group2',
      ],
      [
        'name' => 'Item Five',
        'description' => 'The fifth item',
        'itemgroup' => 'Group2',
      ],
      [
        'name' => 'Item Six',
        'description' => 'The sixth item',
        'itemgroup' => 'Group2',
      ],
      [
        'name' => 'Item Seven',
        'description' => 'The seventh item',
        'itemgroup' => 'Group3',
      ],
      [
        'name' => 'Item Eight',
        'description' => 'The eighth item',
        'itemgroup' => 'Group3',
      ],
      [
        'name' => 'Item Nine',
        'description' => 'The ninth item',
        'itemgroup' => 'Group3',
      ],
      [
        'name' => 'Item Ten',
        'description' => 'The tenth item',
        'itemgroup' => 'Group4',
      ],
      [
        'name' => 'Item Eleven — A Root Node',
        'description' => 'This item cannot be nested under a parent item',
        'itemgroup' => 'Group4',
      ],
      [
        'name' => 'Item Twelve — A Leaf Item',
        'description' => 'This item cannot have child items',
        'itemgroup' => 'Group4',
      ],
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Fixtures::getSampleItems public static function Returns array of sample records for demo purposes.