You are here

public static function YamlFormElementHelper::removeIgnoredProperties in YAML Form 8

Remove ignored properties from an element.

Parameters

array $element: A form element.

Return value

array A form element with ignored properties removed.

2 calls to YamlFormElementHelper::removeIgnoredProperties()
YamlForm::initElementsRecursive in src/Entity/YamlForm.php
Initialize form elements into a flatten array.
YamlFormElementHelperTest::testRemoveIgnoredProperties in tests/src/Unit/YamlFormElementHelperTest.php
Tests YamlFormElementHelper::RemoveIgnoredProperties().

File

src/Utility/YamlFormElementHelper.php, line 162

Class

YamlFormElementHelper
Helper class form element methods.

Namespace

Drupal\yamlform\Utility

Code

public static function removeIgnoredProperties(array $element) {
  foreach ($element as $key => $value) {
    if (Element::property($key) && self::isIgnoredProperty($key)) {
      unset($element[$key]);
    }
  }
  return $element;
}