You are here

protected function ClassSettingsForm::getClassSettings in Feed Import 8

Return settings array.

Return value

array An array of settings

1 call to ClassSettingsForm::getClassSettings()
ClassSettingsForm::buildForm in src/Form/ClassSettingsForm.php
Form constructor.

File

src/Form/ClassSettingsForm.php, line 146

Class

ClassSettingsForm
Form for editing various Feed Importer settings.

Namespace

Drupal\feed_import\Form

Code

protected function getClassSettings($setting) {
  $settings = \Drupal::moduleHandler()
    ->invokeAll('feed_import_setting_types');
  if (!isset($settings[$setting])) {
    return array();
  }
  $setting = $settings[$setting];
  $base = $setting['base'];
  $interface = interface_exists($base);
  $ret = \Drupal::moduleHandler()
    ->invokeAll($setting['hook']);
  unset($settings, $setting);

  // Filter bad classes.
  if ($interface) {
    foreach ($ret as $key => &$r) {
      if (!in_array($base, class_implements($r['class']))) {
        unset($ret[$key]);
      }
    }
  }
  else {
    foreach ($ret as $key => &$r) {
      if ($r['class'] != $base && !is_subclass_of($r['class'], $base)) {
        unset($ret[$key]);
      }
    }
  }
  return $ret;
}