public function StyleswitcherStyleForm::exists in Style Switcher 3.0.x
Same name and namespace in other branches
- 8.2 src/Form/StyleswitcherStyleForm.php \Drupal\styleswitcher\Form\StyleswitcherStyleForm::exists()
Checks whether a submitted machine name value already exists.
Parameters
string $input: User-submitted value.
Return value
array|null Style array on success or NULL otherwise. Style is an associative array as returned from styleswitcher_style_load().
See also
File
- src/
Form/ StyleswitcherStyleForm.php, line 220
Class
- StyleswitcherStyleForm
- Provides a form to add/edit a style.
Namespace
Drupal\styleswitcher\FormCode
public function exists($input) {
// It does not matter what theme to set in this load call, because all
// custom styles exist in all themes. Let's set one from the current page
// just to decrease calculations.
$active_theme_name = $this->themeManager
->getActiveTheme()
->getName();
return styleswitcher_style_load($input, $active_theme_name, 'custom');
}