function shortcode_attrs in Shortcode 7.2
Same name and namespace in other branches
- 6 shortcode.module \shortcode_attrs()
- 7 shortcode.module \shortcode_attrs()
Combines user attributes with known attributes.
The pairs should be considered to be all of the attributes which are supported by the caller and given as a list. The returned attributes will only contain the attributes in the $pairs list.
If the $attrs list has unsupported attributes, then they will be ignored and removed from the final return list.
Parameters
array $pairs: Entire list of supported attributes and their defaults.
array $attrs: User defined attributes in ShortCode tag.
Return value
array Combined and filtered attribute list.
10 calls to shortcode_attrs()
- shortcode_basic_tags_shortcode_button in shortcode_basic_tags/
shortcode_basic_tags.module - Provides process callback for Shortcode button.
- shortcode_basic_tags_shortcode_clear in shortcode_basic_tags/
shortcode_basic_tags.module - Provides process callback for clear ShortCode.
- shortcode_basic_tags_shortcode_dropcap in shortcode_basic_tags/
shortcode_basic_tags.module - Provides process callback for dropcap Shortcode.
- shortcode_basic_tags_shortcode_highlight in shortcode_basic_tags/
shortcode_basic_tags.module - Inserts a span with highlight css class around the text.
- shortcode_basic_tags_shortcode_img in shortcode_basic_tags/
shortcode_basic_tags.module - Provides process callback for img Shortcode.
File
- ./
shortcode.module, line 466 - Provides ShortCodes filter framework and API (like WP ShortCodes)
Code
function shortcode_attrs(array $pairs, array $attrs) {
$attrs = (array) $attrs;
$out = array();
foreach ($pairs as $name => $default) {
if (array_key_exists($name, $attrs)) {
$out[$name] = $attrs[$name];
}
else {
$out[$name] = $default;
}
}
return $out;
}