You are here

public function DefaultMatchingEngine::submitConfigurationForm in CRM Core 8

Same name and namespace in other branches
  1. 8.3 modules/crm_core_match/src/Plugin/crm_core_match/engine/DefaultMatchingEngine.php \Drupal\crm_core_match\Plugin\crm_core_match\engine\DefaultMatchingEngine::submitConfigurationForm()
  2. 8.2 modules/crm_core_match/src/Plugin/crm_core_match/engine/DefaultMatchingEngine.php \Drupal\crm_core_match\Plugin\crm_core_match\engine\DefaultMatchingEngine::submitConfigurationForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides MatchEngineBase::submitConfigurationForm

File

modules/crm_core_match/src/Plugin/crm_core_match/engine/DefaultMatchingEngine.php, line 355

Class

DefaultMatchingEngine
DefaultMatchingEngine class.

Namespace

Drupal\crm_core_match\Plugin\crm_core_match\engine

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {

  // @todo: Build the same form and configuration structure.
  $rules = [];
  $this->configuration = $form_state
    ->getValue('configuration');
  foreach ($form_state
    ->getValue([
    'configuration',
    'rules',
  ]) as $name => $config) {
    if (strpos($name, ':') !== FALSE) {
      list($parent, $child) = explode(':', $name, 2);
      $rules[$parent][$child] = $config;
    }
    else {
      $rules[$name] = $config;
    }
  }
  $this->configuration['rules'] = $rules;
}