Closed (fixed)
Project:
User Restrictions
Version:
2.1.x-dev
Component:
Code
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
21 Oct 2025 at 16:15 UTC
Updated:
6 Nov 2025 at 08:14 UTC
Jump to comment: Most recent
The UserRestrictionAddForm class uses the following code.
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state): void {
parent::submitForm($form, $form_state);
$this->messenger()
->addStatus($this->t('User restriction was created for %label.', ['%label' => $this->entity->label()]));
// Redirect to the user restriction collection page.
$form_state->setRedirect('entity.user_restriction.collection');
}
/**
* {@inheritdoc}
*/
public function actions(array $form, FormStateInterface $form_state): array {
$actions = parent::actions($form, $form_state);
$actions['submit']['#value'] = $this->t('Create new user restriction');
return $actions;
}
Both the UI strings can be improved.
Use User restriction %label has been created. instead of the first string and Add user restriction instead of the second string. The latter string should also be used for the button shown in the list of user restriction entities, which now uses Add rule.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
avpadernoComment #4
avpadernoComment #6
avpadernoComment #9
avpadernoComment #11
avpadernoComment #12
avpaderno