You are here

public static function WebformArrayHelper::removeValue in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Utility/WebformArrayHelper.php \Drupal\webform\Utility\WebformArrayHelper::removeValue()

Remove value from an array.

Parameters

array &$array: An array.

mixed $value: A value.

See also

https://stackoverflow.com/questions/7225070/php-array-delete-by-value-no...

5 calls to WebformArrayHelper::removeValue()
Checkboxes::validateCheckAllOrNone in src/Plugin/WebformElement/Checkboxes.php
Form API callback. Handle check all or none option.
WebformCompositeFormElementTrait::preRenderWebformCompositeFormElement in src/Element/WebformCompositeFormElementTrait.php
Adds form element theming to an element if its title or description is set.
webform_bootstrap_preprocess_form_element in modules/webform_bootstrap/webform_bootstrap.module
Implements hook_preprocess_form_element() for form element templates.
webform_cards_webform_submission_form_alter in modules/webform_cards/webform_cards.module
Implements hook_webform_submission_form_alter().
webform_update_8170 in includes/webform.install.update.inc
Issue #3064070: Split STATE_DRAFT into STATE_DRAFT_CREATED and STATE_DRAFT_UPDATE.

File

src/Utility/WebformArrayHelper.php, line 406

Class

WebformArrayHelper
Provides helper to operate on arrays.

Namespace

Drupal\webform\Utility

Code

public static function removeValue(array &$array, $value) {
  if (($key = array_search($value, $array)) !== FALSE) {
    unset($array[$key]);
  }
  if (static::isSequential($array)) {
    array_values($array);
  }
}