Loading spambot.module +0 −7 Original line number Diff line number Diff line Loading @@ -608,13 +608,6 @@ function spambot_report_account($account, $ip, $evidence, $key = FALSE) { return $success; } /** * Implements hook_form_FORM_ID_alter(). */ function spambot_form_spambot_user_spam_form_alter(&$form, FormStateInterface $form_state) { $form['actions']['submit']['#access'] = FALSE; } /** * Implements hook_node_insert(). */ Loading src/Form/SpambotUserspamForm.php +17 −17 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ use Drupal\Component\Utility\Html; use Drupal\Component\Utility\Unicode; use Drupal\Core\Batch\BatchBuilder; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Link; use Drupal\Core\Messenger\MessengerInterface; Loading @@ -21,7 +21,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; /** * Settings form to save the configuration for Spambot. */ class SpambotUserspamForm extends ConfigFormBase { class SpambotUserspamForm extends FormBase { const SPAMBOT_CONTENT_ACTION_UNPUBLISH = 'unpublish_content'; const SPAMBOT_CONTENT_ACTION_DELETE = 'delete_content'; Loading Loading @@ -69,7 +69,7 @@ class SpambotUserspamForm extends ConfigFormBase { protected $config; /** * Constructs a \Drupal\system\ConfigFormBase object. * Constructs a SpambotUserspamForm object. * * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The factory for configuration objects. Loading @@ -83,14 +83,12 @@ class SpambotUserspamForm extends ConfigFormBase { * Stores runtime messages sent out to individual users on the page. */ public function __construct(ConfigFactoryInterface $config_factory, Connection $connection, EntityTypeManagerInterface $entityTypeManager, ModuleHandlerInterface $moduleHandler, MessengerInterface $messenger) { parent::__construct($config_factory); $this->config = $config_factory->get('spambot.settings'); $this->connection = $connection; $this->entityTypeManager = $entityTypeManager; $this->moduleHandler = $moduleHandler; $this->messenger = $messenger; $this->batchBuilder = new BatchBuilder(); $this->config = \Drupal::config('spambot.settings'); } /** Loading @@ -113,13 +111,6 @@ class SpambotUserspamForm extends ConfigFormBase { return 'spambot_user_spam_form'; } /** * {@inheritdoc} */ protected function getEditableConfigNames() { return ['spambot.settings']; } /** * {@inheritdoc} */ Loading @@ -146,7 +137,12 @@ class SpambotUserspamForm extends ConfigFormBase { $status = $this->t('This account has @n nodes and @c comments.', ['@n' => $node_count, '@c' => $comment_count]); } $form['check'] = [ $form['check_actions'] = [ '#type' => 'actions', '#weight' => -1, ]; $form['check_actions']['check'] = [ '#type' => 'submit', '#value' => $this->t('Check if this account matches a known spammer'), ]; Loading Loading @@ -257,7 +253,11 @@ class SpambotUserspamForm extends ConfigFormBase { ], ]; $form['action']['action'] = [ $form['action']['actions'] = [ '#type' => 'actions', ]; $form['action']['actions']['action'] = [ '#type' => 'submit', '#value' => $this->t('Take action'), ]; Loading @@ -267,7 +267,7 @@ class SpambotUserspamForm extends ConfigFormBase { '#value' => $user->id(), ]; return parent::buildForm($form, $form_state); return $form; } /** Loading Loading @@ -299,7 +299,7 @@ class SpambotUserspamForm extends ConfigFormBase { $values = $form_state->getValues(); /** @var \Drupal\user\UserInterface $account */ $account = $this->entityTypeManager->getStorage('user')->load($values['uid']); $config = \Drupal::config('spambot.settings'); $config = $this->config('spambot.settings'); if ($form_state->getValue('op') == $form_state->getValue('check')) { static::checkSubmit($account, $config); Loading Loading
spambot.module +0 −7 Original line number Diff line number Diff line Loading @@ -608,13 +608,6 @@ function spambot_report_account($account, $ip, $evidence, $key = FALSE) { return $success; } /** * Implements hook_form_FORM_ID_alter(). */ function spambot_form_spambot_user_spam_form_alter(&$form, FormStateInterface $form_state) { $form['actions']['submit']['#access'] = FALSE; } /** * Implements hook_node_insert(). */ Loading
src/Form/SpambotUserspamForm.php +17 −17 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ use Drupal\Component\Utility\Html; use Drupal\Component\Utility\Unicode; use Drupal\Core\Batch\BatchBuilder; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Link; use Drupal\Core\Messenger\MessengerInterface; Loading @@ -21,7 +21,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; /** * Settings form to save the configuration for Spambot. */ class SpambotUserspamForm extends ConfigFormBase { class SpambotUserspamForm extends FormBase { const SPAMBOT_CONTENT_ACTION_UNPUBLISH = 'unpublish_content'; const SPAMBOT_CONTENT_ACTION_DELETE = 'delete_content'; Loading Loading @@ -69,7 +69,7 @@ class SpambotUserspamForm extends ConfigFormBase { protected $config; /** * Constructs a \Drupal\system\ConfigFormBase object. * Constructs a SpambotUserspamForm object. * * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The factory for configuration objects. Loading @@ -83,14 +83,12 @@ class SpambotUserspamForm extends ConfigFormBase { * Stores runtime messages sent out to individual users on the page. */ public function __construct(ConfigFactoryInterface $config_factory, Connection $connection, EntityTypeManagerInterface $entityTypeManager, ModuleHandlerInterface $moduleHandler, MessengerInterface $messenger) { parent::__construct($config_factory); $this->config = $config_factory->get('spambot.settings'); $this->connection = $connection; $this->entityTypeManager = $entityTypeManager; $this->moduleHandler = $moduleHandler; $this->messenger = $messenger; $this->batchBuilder = new BatchBuilder(); $this->config = \Drupal::config('spambot.settings'); } /** Loading @@ -113,13 +111,6 @@ class SpambotUserspamForm extends ConfigFormBase { return 'spambot_user_spam_form'; } /** * {@inheritdoc} */ protected function getEditableConfigNames() { return ['spambot.settings']; } /** * {@inheritdoc} */ Loading @@ -146,7 +137,12 @@ class SpambotUserspamForm extends ConfigFormBase { $status = $this->t('This account has @n nodes and @c comments.', ['@n' => $node_count, '@c' => $comment_count]); } $form['check'] = [ $form['check_actions'] = [ '#type' => 'actions', '#weight' => -1, ]; $form['check_actions']['check'] = [ '#type' => 'submit', '#value' => $this->t('Check if this account matches a known spammer'), ]; Loading Loading @@ -257,7 +253,11 @@ class SpambotUserspamForm extends ConfigFormBase { ], ]; $form['action']['action'] = [ $form['action']['actions'] = [ '#type' => 'actions', ]; $form['action']['actions']['action'] = [ '#type' => 'submit', '#value' => $this->t('Take action'), ]; Loading @@ -267,7 +267,7 @@ class SpambotUserspamForm extends ConfigFormBase { '#value' => $user->id(), ]; return parent::buildForm($form, $form_state); return $form; } /** Loading Loading @@ -299,7 +299,7 @@ class SpambotUserspamForm extends ConfigFormBase { $values = $form_state->getValues(); /** @var \Drupal\user\UserInterface $account */ $account = $this->entityTypeManager->getStorage('user')->load($values['uid']); $config = \Drupal::config('spambot.settings'); $config = $this->config('spambot.settings'); if ($form_state->getValue('op') == $form_state->getValue('check')) { static::checkSubmit($account, $config); Loading