You are here

protected function StaticFieldsForm::getOptionsGroup in Feed Import 8

Returns an array for select options group

Parameters

array $el: An array of available fields

Return value

array An array of optgroups.

See also

getFieldOptions()

1 call to StaticFieldsForm::getOptionsGroup()
StaticFieldsForm::buildForm in src/Form/StaticFieldsForm.php
Form constructor.

File

src/Form/StaticFieldsForm.php, line 243
Contains \Drupal\feed_import\Form\StaticFieldsForm

Class

StaticFieldsForm

Namespace

Drupal\feed_import\Form

Code

protected function getOptionsGroup(array $el) {
  $opt = array();

  // Handle properties.
  if (isset($el['#'])) {
    $opt[t('Properties')
      ->render()] = $el['#'];
    unset($el['#']);
  }

  // Handle fields.
  foreach ($el as $f => &$val) {
    if ($val) {
      $p = t('Field @name', array(
        '@name' => $f,
      ));
      $opt[$p
        ->render()] = array_flip($val);
    }
  }
  return $opt;
}