/** * {@inheritdoc} */ public function save(array $form, FormStateInterface $form_state) { /** @var \Drupal\rng\RuleComponentInterface $component */ $component = $this->getEntity(); $is_new = $component->isNew(); $plugin_configuration = $this->plugin->getConfiguration(); $component->setConfiguration($plugin_configuration); $component->save(); $type = $this->entity->getType(); $types = ['action' => $this->t('Action'), 'condition' => $this->t('Condition')]; $t_args = ['@type' => isset($types[$type]) ? $types[$type] : $this->t('Component')]; if ($is_new) { drupal_set_message(t('@type created.', $t_args)); } else { drupal_set_message(t('@type updated.', $t_args)); } }