Twitter\WordPress\Shortcodes\Share::addPostMetaOptions PHP Method

addPostMetaOptions() protected static method

Add post meta values to a Tweet button options array
Since: 1.0.0
protected static addPostMetaOptions ( array $options ) : array
$options array Tweet button options array { @type string option name @type string|array option value }
return array Tweet button options array { @type string option name @type string|array option value }
    protected static function addPostMetaOptions($options)
    {
        if (!is_array($options)) {
            $options = array();
        }
        $post_meta = static::getPostMeta();
        if (empty($post_meta)) {
            return $options;
        }
        // allow shortcode text to override post text
        // example: multiple Tweet buttons in a post
        if (!(isset($options['text']) && trim($options['text']))) {
            if (isset($post_meta['text'])) {
                $text = trim($post_meta['text']);
                if ($text) {
                    $options['text'] = $text;
                }
                unset($text);
            }
        }
        // allow shortcode hashtags to override post hashtags
        // example: multiple Tweet buttons in a post
        if (!isset($options['hashtags']) || empty($options['hashtags'])) {
            if (isset($post_meta['hashtags']) && is_array($post_meta['hashtags']) && !empty($post_meta['hashtags'])) {
                $options['hashtags'] = $post_meta['hashtags'];
            }
        }
        return $options;
    }