Utils::get_attributes_string( TribeShortcodearray $settings, TribeShortcodearray $allowed = array() )
Convert settings to a set of shortcode attributes.
Contents
Parameters
- $settings
-
(<span class="TribeShortcodearray">TribeShortcodearray) (Required) Widget settings.
- $allowed
-
(<span class="TribeShortcodearray">TribeShortcodearray) (Optional) Allowed settings for shortcode.
Default value: array()
Return
(string) Shortcode attributes string.
Source
File: src/Tribe/Shortcode/Utils.php
public static function get_attributes_string( $settings, $allowed = [] ) { $settings_string = ''; $allowed = array_flip( $allowed ); foreach ( $settings as $key => $value ) { if ( ! empty( $allowed ) && ! isset( $allowed[ $key ] ) ) { continue; } $key = esc_attr( $key ); if ( is_array( $value ) ) { $value = implode( ', ', $value ); } $value = esc_attr( $value ); $settings_string .= " {$key}=\"{$value}\""; } return $settings_string; }
Changelog
Version | Description |
---|---|
4.13.0 | Introduced. |