Astra_Attr::astra_parse_attr( string $context, array $attributes = array(), array $args = array() )
Merge array of attributes with defaults, and apply contextual filter on array.
Description
The contextual filter is of the form astra_attr_{context}.
Parameters
- $context
-
(string) (Required) The context, to build filter name.
- $attributes
-
(array) (Optional) Extra attributes to merge with defaults.
Default value: array()
- $args
-
(array) (Optional) Custom data to pass to filter.
Default value: array()
Return
(array) Merged and filtered attributes.
Source
File: inc/core/class-astra-attr.php
public function astra_parse_attr( $context, $attributes = array(), $args = array() ) {
$defaults = array(
'class' => sanitize_html_class( $context ),
);
$attributes = wp_parse_args( $attributes, $defaults );
// Contextual filter.
return apply_filters( "astra_attr_{$context}", $attributes, $context, $args );
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 1.6.2 | Introduced. |