Twitter\WordPress\Shortcodes\EmbeddedTweet::shortcodeParamsToOEmbedParams PHP Method

shortcodeParamsToOEmbedParams() public static method

Convert shortcode parameters into query parameters supported by the Twitter oEmbed endpoint
Since: 1.0.0
public static shortcodeParamsToOEmbedParams ( string $tweet_id, array $shortcode_options = [] ) : array
$tweet_id string Tweet identifier
$shortcode_options array customizations specified in the shortcode
return array associative array of query parameters ready for http_build_query { @type string query parameter name @type string|bool query parameter value }
    public static function shortcodeParamsToOEmbedParams($tweet_id, $shortcode_options = array())
    {
        $query_parameters = static::getBaseOEmbedParams($tweet_id);
        if (empty($query_parameters)) {
            return array();
        }
        // test for valid align value
        if (isset($shortcode_options['align']) && $shortcode_options['align'] && array_key_exists($shortcode_options['align'], static::$ALIGN_OPTIONS)) {
            $query_parameters['align'] = $shortcode_options['align'];
        }
        // oembed parameters are the opposite of widget parameters
        // hide_* in oEmbed API
        foreach (array('cards' => 'hide_media', 'conversation' => 'hide_thread') as $bool_option => $oembed_parameter) {
            if (isset($shortcode_options[$bool_option]) && false === $shortcode_options[$bool_option]) {
                $query_parameters[$oembed_parameter] = true;
            }
        }
        return $query_parameters;
    }