You are here

class PrivateMessageThreadDeleteForm in Opigno messaging 3.x

Override the private message thread delete form.

Hierarchy

Expanded class hierarchy of PrivateMessageThreadDeleteForm

1 file declares its use of PrivateMessageThreadDeleteForm
opigno_messaging.module in ./opigno_messaging.module
Contains opigno_messaging.module.

File

src/Form/PrivateMessageThreadDeleteForm.php, line 12

Namespace

Drupal\opigno_messaging\Form
View source
class PrivateMessageThreadDeleteForm extends DeleteFormBase {

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form = parent::buildForm($form, $form_state);
    $form['description']['#markup'] = $this
      ->t('Do you really want to delete this discussion?');

    // Update buttons order, add extra classes.
    $form['actions']['submit']['#attributes'] = [
      'class' => [
        'btn',
        'btn-rounded',
        'btn-border-red',
      ],
    ];
    $form['actions']['submit']['#weight'] = -50;
    $form['actions']['cancel']['#attributes'] = [
      'class' => [
        'btn',
        'btn-rounded',
        'use-ajax',
      ],
    ];
    $form['actions']['submit']['#weight'] = 50;
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function getQuestion() {
    return $this
      ->t('Do you really want to delete this discussion?');
  }

  /**
   * {@inheritdoc}
   */
  public function getCancelUrl() {
    return Url::fromRoute('opigno_messaging.close_modal');
  }

  /**
   * {@inheritdoc}
   */
  public function getConfirmText() {
    return $this
      ->t('Delete');
  }

}

Members