FlagConfirmForm.php in Flag 8.4
File
src/Form/FlagConfirmForm.php
View source
<?php
namespace Drupal\flag\Form;
use Drupal\Core\Form\FormStateInterface;
use Drupal\flag\Plugin\ActionLink\FormEntryInterface;
class FlagConfirmForm extends FlagConfirmFormBase {
public function getFormId() {
return 'flag_confirm_form';
}
public function getQuestion() {
$link_plugin = $this->flag
->getLinkTypePlugin();
return $link_plugin instanceof FormEntryInterface ? $link_plugin
->getFlagQuestion() : $this
->t('Flag this content');
}
public function getDescription() {
return $this->flag
->getLongText('flag');
}
public function getConfirmText() {
$link_plugin = $this->flag
->getLinkTypePlugin();
return $link_plugin instanceof FormEntryInterface ? $link_plugin
->getCreateButtonText() : $this
->t('Create flagging');
}
public function submitForm(array &$form, FormStateInterface $form_state) {
\Drupal::service('flag')
->flag($this->flag, $this->entity);
}
}