You are here

public static function SubformState::createForSubform in Markdown 8.2

Same name in this branch
  1. 8.2 src/Form/SubformState.php \Drupal\markdown\Form\SubformState::createForSubform()
  2. 8.2 src/BcSupport/SubformState.php \Drupal\markdown\BcSupport\SubformState::createForSubform()

Creates a new instance for a subform.

Parameters

mixed[] $subform: The subform for which to create a form state.

mixed[] $parent_form: The subform's parent form.

\Drupal\Core\Form\FormStateInterface $parent_form_state: The parent form state.

Return value

static

Overrides SubformState::createForSubform

9 calls to SubformState::createForSubform()
CommonMark::buildConfigurationForm in src/Plugin/Markdown/CommonMark/CommonMark.php
Form constructor.
FilterMarkdown::processSubform in src/Plugin/Filter/FilterMarkdown.php
Process callback for constructing markdown settings for this filter.
ParserConfigurationForm::buildParser in src/Form/ParserConfigurationForm.php
Builds the parser form elements.
ParserConfigurationForm::buildParserExtensions in src/Form/ParserConfigurationForm.php
Builds the extension settings for a specific parser.
ParserConfigurationForm::buildParserSettings in src/Form/ParserConfigurationForm.php
Builds the settings for a specific parser.

... See full list

File

src/Form/SubformState.php, line 57

Class

SubformState
Markdown subform state.

Namespace

Drupal\markdown\Form

Code

public static function createForSubform(array &$subform, array &$parent_form, FormStateInterface $parent_form_state) {

  // Attempt to construct #parents array based on passed values.
  if (!isset($subform['#parents']) && $parent_form_state instanceof SubformStateInterface && ($name = array_search($subform, $parent_form, TRUE))) {
    $subform['#parents'] = array_merge($parent_form_state
      ->getAllParents(), [
      $name,
    ]);
  }
  return parent::createForSubform($subform, $parent_form, $parent_form_state);
}