MC4WP_Form_Asset_Manager::load_stylesheets PHP Method

load_stylesheets() public method

Load the various stylesheets
public load_stylesheets ( )
    public function load_stylesheets()
    {
        $stylesheets = $this->get_active_stylesheets();
        foreach ($stylesheets as $stylesheet) {
            if (!$this->is_registered_stylesheet($stylesheet)) {
                continue;
            }
            $handle = 'mc4wp-form-' . $stylesheet;
            wp_enqueue_style($handle, $this->get_stylesheet_url($stylesheet), array(), MC4WP_VERSION);
            add_editor_style($this->get_stylesheet_url($stylesheet));
        }
        /**
         * @ignore
         */
        do_action('mc4wp_load_form_stylesheets', $stylesheets);
        return true;
    }

Usage Example

 /**
  * Registers UI for when shortcake is activated
  */
 public function register_shortcake_ui()
 {
     $assets = new MC4WP_Form_Asset_Manager();
     $assets->load_stylesheets();
     $forms = mc4wp_get_forms();
     $options = array();
     foreach ($forms as $form) {
         $options[$form->ID] = $form->name;
     }
     /**
      * Register UI for your shortcode
      *
      * @param string $shortcode_tag
      * @param array $ui_args
      */
     shortcode_ui_register_for_shortcode('mc4wp_form', array('label' => esc_html__('MailChimp Sign-Up Form', 'mailchimp-for-wp'), 'listItemImage' => 'dashicons-feedback', 'attrs' => array(array('label' => esc_html__('Select the form to show', 'mailchimp-for-wp'), 'attr' => 'id', 'type' => 'select', 'options' => $options))));
 }