You are here

protected function ClassSettingsForm::generateClassOptionsForm in Feed Import 8

Returns all form items for class options combined with parents.

Parameters

array &$setting: Current setting.

array &$parent: Parent setting.

array &$settings: All defined settings.

Return value

array An array containing all form items

1 call to ClassSettingsForm::generateClassOptionsForm()
ClassSettingsForm::getClassOptions in src/Form/ClassSettingsForm.php
Gets all form items for class options.

File

src/Form/ClassSettingsForm.php, line 223

Class

ClassSettingsForm
Form for editing various Feed Importer settings.

Namespace

Drupal\feed_import\Form

Code

protected function generateClassOptionsForm(array &$setting, array &$parent, array &$settings) {
  if ($parent['inherit_options'] && isset($settings[$setting['inherit_options']])) {
    $options = $this
      ->generateClassOptionsForm($parent, $settings[$setting['inherit_options']], $settings);
  }
  else {
    $options = $parent['options'];
  }
  $ret = $setting['options'];
  foreach ($ret as $key => &$opt) {
    if (isset($options[$key])) {
      if ($opt === FALSE) {
        unset($ret[$key]);
      }
      elseif (!isset($opt['#type']) || $opt['#type'] == $options[$key]['#type']) {
        $opt += $options[$key];
      }
      unset($options[$key]);
    }
  }
  return $options + $ret;
}