Elementor\Control_Media::get_image_alt PHP Метод

get_image_alt() публичный статический Метод

public static get_image_alt ( $instance )
    public static function get_image_alt($instance)
    {
        if (empty($instance['id'])) {
            return '';
        }
        $attachment_id = $instance['id'];
        if (!$attachment_id) {
            return '';
        }
        $attachment = get_post($attachment_id);
        if (!$attachment) {
            return '';
        }
        $alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
        if (!$alt) {
            $alt = $attachment->post_excerpt;
            if (!$alt) {
                $alt = $attachment->post_title;
            }
        }
        return trim(strip_tags($alt));
    }