You are here

protected function ManageComponentAttributesForm::validateCssClass in Layout Builder Component Attributes 1.2.x

Same name and namespace in other branches
  1. 1.0.x src/Form/ManageComponentAttributesForm.php \Drupal\layout_builder_component_attributes\Form\ManageComponentAttributesForm::validateCssClass()
  2. 1.1.x src/Form/ManageComponentAttributesForm.php \Drupal\layout_builder_component_attributes\Form\ManageComponentAttributesForm::validateCssClass()

Helper function to validate CSS classes.

Parameters

string $value: The CSS class to be validated.

Return value

bool Whether or not the class is valid.

1 call to ManageComponentAttributesForm::validateCssClass()
ManageComponentAttributesForm::validateForm in src/Form/ManageComponentAttributesForm.php
Form validation handler.

File

src/Form/ManageComponentAttributesForm.php, line 395

Class

ManageComponentAttributesForm
Provides a form for managing block attributes.

Namespace

Drupal\layout_builder_component_attributes\Form

Code

protected function validateCssClass($value) {
  if ($value == Html::cleanCssIdentifier($value)) {
    return TRUE;
  }
  return FALSE;
}