You are here

public function SubformState::getAllParents in Markdown 8.2

Retrieves all parents for the form state up to this point.

Parameters

string $property: The property name (#parents or #array_parents).

Return value

array An indexed array of parents.

Throws

\InvalidArgumentException Thrown when the requested property does not exist.

\UnexpectedValueException Thrown when the subform is not contained by the given parent form.

Overrides SubformStateInterface::getAllParents

2 calls to SubformState::getAllParents()
SubformState::addElementState in src/Form/SubformState.php
Adds a #states selector to an element.
SubformState::createParents in src/Form/SubformState.php
Creates a new parents array for a given element.

File

src/Form/SubformState.php, line 89

Class

SubformState
Markdown subform state.

Namespace

Drupal\markdown\Form

Code

public function getAllParents($property = '#parents') {
  if (!isset($this->parentForm[$property])) {
    throw new \RuntimeException(sprintf('The subform and parent form must contain the %s property, which must be an array. Try calling this method from a #process callback instead.', $property));
  }

  // Merge the parent form and subform's relative parents.
  return array_merge($this->parentForm[$property], $this
    ->getParents($property));
}