<?php
/**
 * Add viewport size information to WordPress admin bar.
 *
 * @param WP_Admin_Bar $wp_admin_bar
 */
if (!function_exists('pac_drh_add_viewport_size_admin_bar')):
    function pac_drh_add_viewport_size_admin_bar($wp_admin_bar)
    {
        $wp_admin_bar->add_menu(
            [
                'id' => 'pac_drh_viewport_size',
                'title' => __('Viewport Size: ', 'divi-responsive-helper'),
                'href' => '',
                'parent' => 'top-secondary',
                'meta' => [
                    'class' => 'viewport__size',
                ],
            ]
        );
    }

    if (pac_drh_get_settings_enabled('pac_drh_enable_view_port_size') && pac_drh_get_settings_enabled('pac_drh_enable_viewport_adminbar') && !is_admin()) {
        add_action('admin_bar_menu', 'pac_drh_add_viewport_size_admin_bar');
    }
endif;