if (!preg_match('/^[a-z_][a-z0-9_]*$/', $form_state->getValue('id'))) {
      $form_state->setErrorByName('label', 'The flag name may only contain lowercase letters, underscores, and numbers.');
    }

This code is repeated in 2 action link plugin classes. Presumably that means it's not getting run if another action link is used.

It should be in the main flag form system.

Though if we're using a machine name form element, is this actually necessary?

Comments

joachim’s picture

Title: validation of flag name should be done in the main form, not in action link plugins » validation of flag machine name is not needed

Confirming that with the code checking this commented out, core handles this through the machine_name element's built-in validation:

> The machine-readable name must contain only lowercase letters, numbers, and underscores.

joachim’s picture

Status: Active » Needs review
StatusFileSize
new1.28 KB

  • joachim authored 0e2bae1 on 8.x-4.x
    Issue #2461111 by joachim: Removed validation of flag machine name.
    
socketwench’s picture

Status: Needs review » Fixed

Committed!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.