You are here

protected function TacjsSettings::getFields in TacJS 8

Same name and namespace in other branches
  1. 8.2 src/TacjsSettings.php \Drupal\tacjs\TacjsSettings::getFields()

GetFields.

Parameters

mixed $values: It has all congif chooses in backoffice.

mixed $data: Constant variable contains the services.

mixed $type: this variable juste for check if service == "Regi publicitire".

Return value

array Return all services selected.

1 call to TacjsSettings::getFields()
TacjsSettings::getFieldsSelects in src/TacjsSettings.php
Function return config selected.

File

src/TacjsSettings.php, line 265

Class

TacjsSettings
Class TacjsSettings.

Namespace

Drupal\tacjs

Code

protected function getFields($values, $data, $type = NULL) {
  $result = [];
  if ($type == "module") {
    $config = \Drupal::getContainer()
      ->get('config.factory')
      ->getEditable('tacjs.admin_settings_form');
    $result['options'] = $config
      ->get('type_regie_publicitaire');
  }
  foreach ($values as $item) {
    if (!empty($data[$item])) {
      if ($type == "module") {
        $pos = array_search($data[$item]['value'], $result['options']);
        if ($pos != FALSE) {
          unset($result['options'][$item]);
        }
      }
      $result[] = $data[$item];
    }
  }
  return $result;
}