You are here

public function Submission::valueByKey in Little helpers 7.2

Same name and namespace in other branches
  1. 7 src/Webform/Submission.php \Drupal\little_helpers\Webform\Submission::valueByKey()

Retrieve a single value by a component's form_key.

Parameters

string $form_key: The form_key to look for.

Return value

mixed A value if possible or NULL otherwise.

File

src/Webform/Submission.php, line 75

Class

Submission
A useful wrapper for webform submission objects.

Namespace

Drupal\little_helpers\Webform

Code

public function valueByKey($form_key) {
  if ($values = $this
    ->valuesByKey($form_key)) {
    return reset($values);
  }
  return NULL;
}