You are here

protected function LayoutBuilderQuickEditTest::replaceLayoutBuilderFieldIdKeys in Drupal 8

Replaces the array keys with Layout Builder field IDs when needed.

Parameters

array $array: The array with field IDs as keys.

Return value

array The array with the keys replaced.

2 calls to LayoutBuilderQuickEditTest::replaceLayoutBuilderFieldIdKeys()
LayoutBuilderQuickEditTest::assertEntityInstanceFieldMarkup in core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php
Asserts all in-place editable fields with markup expectations.
LayoutBuilderQuickEditTest::assertEntityInstanceFieldStates in core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php
Asserts all FieldModels for the given entity instance.

File

core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php, line 218

Class

LayoutBuilderQuickEditTest
Tests that Layout Builder functions with Quick Edit.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function replaceLayoutBuilderFieldIdKeys(array $array) {
  if (!$this->usingLayoutBuilder) {
    return $array;
  }
  $replacement = [];
  foreach ($array as $field_key => $value) {
    $new_field_key = $this
      ->getQuickEditFieldId($field_key);
    $replacement[$new_field_key] = $value;
  }
  return $replacement;
}