public function AnonymousPublishingClAdminBlocked::submitForm in Anonymous Publishing 8
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- modules/
anonymous_publishing_cl/ src/ Form/ AnonymousPublishingClAdminBlocked.php, line 141
Class
Namespace
Drupal\anonymous_publishing_cl\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$operation = $form_state
->getValue('operation');
$ids = $form_state
->getValue('items');
$blocked = FALSE;
foreach ($ids as $id) {
if ($operation == 'block') {
$blocked = TRUE;
}
$this->database
->update('anonymous_publishing_emails')
->fields('anonymous_publishing_emails', array(
'blocked' => $blocked,
))
->condition('auid', $id)
->execute();
}
$this
->messenger()
->addMessage($this
->t('The update has been performed.'));
}