Esempio n. 1
0
  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    if ($this->linkitProfile->getAttributes()->has($this->linkitAttribute->getPluginId())) {
      $this->linkitProfile->removeAttribute($this->linkitAttribute->getPluginId());
      $this->linkitProfile->save();

      drupal_set_message($this->t('The attribute %label has been deleted.', ['%label' => $this->linkitAttribute->getLabel()]));
      $this->logger('linkit')->notice('The attribute %label has been deleted in the @profile profile.', [
        '%label' => $this->linkitAttribute->getLabel(),
        '@profile' => $this->linkitProfile->label(),
      ]);
    }

    $form_state->setRedirect('linkit.attributes', [
      'linkit_profile' => $this->linkitProfile->id(),
    ]);
  }