Sequence.php

Contains \Drupal\Core\Config\Schema\Sequence.

Namespace

Drupal\Core\Config\Schema

File

drupal/core/lib/Drupal/Core/Config/Schema/Sequence.php
View source
<?php

/**
 * @file
 * Contains \Drupal\Core\Config\Schema\Sequence.
 */
namespace Drupal\Core\Config\Schema;

use Drupal\Core\TypedData\ListInterface;

/**
 * Defines a configuration element of type Sequence.
 */
class Sequence extends ArrayElement implements ListInterface {

  /**
   * Overrides ArrayElement::parse()
   */
  protected function parse() {
    $definition = $definition = $this
      ->getItemDefinition();
    $elements = array();
    foreach ($this->value as $key => $value) {
      $elements[$key] = $this
        ->parseElement($key, $value, $definition);
    }
    return $elements;
  }

  /**
   * Implements Drupal\Core\TypedData\ListInterface::isEmpty().
   */
  public function isEmpty() {
    return empty($this->value);
  }

  /**
   * Implements Drupal\Core\TypedData\ListInterface::getItemDefinition().
   */
  public function getItemDefinition() {
    return $this->definition['sequence'][0];
  }

  /**
   * Implements \Drupal\Core\TypedData\ListInterface::onChange().
   */
  public function onChange($delta) {

    // Notify the parent of changes.
    if (isset($this->parent)) {
      $this->parent
        ->onChange($this->name);
    }
  }

}

Classes

Namesort descending Description
Sequence Defines a configuration element of type Sequence.