You are here

public function Forms::getForms in FZ152 8

Returns a list of form to and confirmation for sending private data.

Return value

array Array with form names to add checkbox:

  • "form_id": The form id. Can contains wildcards "*".
  • "weight": (optional) The weight for checkbox in the form.

Overrides Fz152PluginBase::getForms

File

src/Plugin/Fz152/Forms.php, line 32

Class

Forms
Provides an annotated Fz152 plugin for config forms.

Namespace

Drupal\fz152\Plugin\Fz152

Code

public function getForms() {
  $config = \Drupal::config('fz152.forms');
  $forms_settings = $config
    ->get('forms');
  $forms = [];
  if (!empty($forms_settings)) {
    foreach (explode(PHP_EOL, $forms_settings) as $form_id) {
      $form_id_exploded = explode('|', $form_id);
      $forms[] = [
        'form_id' => $form_id_exploded[0],
        'weight' => isset($form_id_exploded[1]) ? $form_id_exploded[1] : NULL,
      ];
    }
  }
  return $forms;
}