You are here

public function BackgroundImageFormTrait::getSubformValue in Background Image 8

Same name and namespace in other branches
  1. 2.x src/BackgroundImageFormTrait.php \Drupal\background_image\BackgroundImageFormTrait::getSubformValue()
  2. 2.0.x src/BackgroundImageFormTrait.php \Drupal\background_image\BackgroundImageFormTrait::getSubformValue()

Retrieves a subform value.

Parameters

string|string[] $key: The key to retrieve.

mixed $default: The default value to use if $key doesn't exist.

Return value

mixed|null The value of $key or $default.

7 calls to BackgroundImageFormTrait::getSubformValue()
BackgroundImageForm::buildImage in src/Form/BackgroundImageForm.php
Builds the "Image" group.
BackgroundImageForm::buildSetting in src/Form/BackgroundImageForm.php
Builds a setting element.
BackgroundImageForm::buildTypeSelection in src/Form/BackgroundImageForm.php
Builds the new type selection step.
BackgroundImageForm::getSettingValue in src/Form/BackgroundImageForm.php
Retrieves a setting value from the form state values or default values.
BackgroundImageForm::setSubformState in src/Form/BackgroundImageForm.php

... See full list

File

src/BackgroundImageFormTrait.php, line 391

Class

BackgroundImageFormTrait
Trait BackgroundImageFormTrait.

Namespace

Drupal\background_image

Code

public function &getSubformValue($key, $default = NULL) {
  $exists = NULL;
  $value =& NestedArray::getValue($this
    ->getSubformValues(), (array) $key, $exists);
  if (!$exists) {
    $value = $default;
  }
  return $value;
}