You are here

public function UtilityBase::getSubmitForm in SimpleAds 8

File

src/UtilityBase.php, line 57

Class

UtilityBase
Utility ads utility class.

Namespace

Drupal\simpleads

Code

public function getSubmitForm($op, $options, FormStateInterface $form_state, $type = NULL, $id = NULL) {
  $manager = \Drupal::service($this->manager_name);
  $plugins = $manager
    ->getDefinitions();
  $plugin = $manager
    ->createInstance($plugins[$type]['id']);
  if ($op == 'create') {
    return $plugin
      ->createFormSubmit($options, $form_state, $type);
  }
  else {
    if ($op == 'update') {
      return $plugin
        ->updateFormSubmit($options, $form_state, $type, $id);
    }
    else {
      return $plugin
        ->deleteFormSubmit($options, $form_state, $type, $id);
    }
  }
}