function hook_ui_pattern_settings_variant_alter in UI Patterns Settings 8.2
Alter UI Patterns variant before they are passed to settings.
Implement this hook to override the configured pattern variant for specific patterns or to configure custom variant logic.
Parameters
$variant: Pattern variant.
array $context: Context Properties: The context and the entity of the pattern. keys:
- #pattern_id: The pattern id.
- #variant: The variant id.
- #context: The pattern context
See also
\Drupal\ui_patterns_settings\Element\PatternSettings
1 invocation of hook_ui_pattern_settings_variant_alter()
- PatternSettings::processSettings in src/
Element/ PatternSettings.php - Process settings.
File
- ./
ui_patterns_settings.api.php, line 48 - API file.
Code
function hook_ui_pattern_settings_variant_alter(&$variant, array $context) {
if ($context['#pattern_id'] === 'section') {
$variant = 'column_1';
}
}