You are here

protected static function Datelist::checkEmptyInputs in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Datetime/Element/Datelist.php \Drupal\Core\Datetime\Element\Datelist::checkEmptyInputs()

Checks the input array for empty values.

Input array keys are checked against values in the parts array. Elements not in the parts array are ignored. Returns an array representing elements from the input array that have no value. If no empty values are found, returned array is empty.

Parameters

array $input: Array of individual inputs to check for value.

array $parts: Array to check input against, ignoring elements not in this array.

Return value

array Array of keys from the input array that have no value, may be empty.

2 calls to Datelist::checkEmptyInputs()
Datelist::validateDatelist in core/lib/Drupal/Core/Datetime/Element/Datelist.php
Validation callback for a datelist element.
Datelist::valueCallback in core/lib/Drupal/Core/Datetime/Element/Datelist.php
Validates the date type to adjust 12 hour time and prevent invalid dates. If the date is valid, the date is set in the form.

File

core/lib/Drupal/Core/Datetime/Element/Datelist.php, line 350
Contains \Drupal\Core\Datetime\Element\Datelist.

Class

Datelist
Provides a datelist element.

Namespace

Drupal\Core\Datetime\Element

Code

protected static function checkEmptyInputs($input, $parts) {

  // Filters out empty array values, any valid value would have a string length.
  $filtered_input = array_filter($input, 'strlen');
  return array_diff($parts, array_keys($filtered_input));
}