function LayoutBuilderQuickEditTest::replaceLayoutBuilderFieldIdKeys

Same name in other branches
  1. 8.9.x core/modules/layout_builder/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php \Drupal\Tests\layout_builder\FunctionalJavascript\LayoutBuilderQuickEditTest::replaceLayoutBuilderFieldIdKeys()

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/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php
Asserts all in-place editable fields with markup expectations.
LayoutBuilderQuickEditTest::assertEntityInstanceFieldStates in core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php
Asserts all FieldModels for the given entity instance.

File

core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php, line 243

Class

LayoutBuilderQuickEditTest
Tests that Layout Builder functions with Quick Edit.

Namespace

Drupal\Tests\quickedit\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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.