You are here

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

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

Get the prev(ious) key in an array.

Parameters

array $array: An array.

string $key: A key.

Return value

string|null The prev(ious) key in an array or NULL if there is no previous key.

2 calls to WebformArrayHelper::getPreviousKey()
WebformArrayHelperTest::testGetKey in tests/src/Unit/Utility/WebformArrayHelperTest.php
Tests navigating an associative array's keys.
WebformSubmissionForm::getPreviousPage in src/WebformSubmissionForm.php
Get previous page's key.

File

src/Utility/WebformArrayHelper.php, line 157

Class

WebformArrayHelper
Provides helper to operate on arrays.

Namespace

Drupal\webform\Utility

Code

public static function getPreviousKey(array $array, $key) {
  return self::getKey($array, $key, 'prev');
}