Esempio n. 1
0
 /**
  * Manually register dialog assets in Types_Asset_Manager because by now we have already missed the
  * toolset_add_registered_styles and toolset_add_registered_scripts filters (but there is still enough time
  * to enqueue).
  *
  * @since 2.0
  */
 protected function late_register_assets()
 {
     // Get script and styles from parent methods, and register them manually.
     $styles = $this->register_styles(array());
     foreach ($styles as $style) {
         Types_Asset_Manager::get_instance()->register_toolset_style($style);
     }
     $scripts = $this->register_scripts(array());
     foreach ($scripts as $script) {
         Types_Asset_Manager::get_instance()->register_toolset_script($script);
     }
 }
 /**
  * Manually register dialog assets in Types_Asset_Manager because by now we have already missed the
  * toolset_add_registered_styles and toolset_add_registered_scripts filters (but there is still enough time
  * to enqueue).
  *
  * @since 2.0
  */
 protected function late_register_assets()
 {
     /*
      * Toolset_DialogBoxes::register_styles() no longer exists
      * https://git.onthegosystems.com/toolset/toolset-common/commit/cb176128ac8382cebbad46a39848b4c76fdcc7a7
      *
     // Get script and styles from parent methods, and register them manually.
     $styles = $this->register_styles( array() );
     foreach( $styles as $style ) {
     	Types_Asset_Manager::get_instance()->register_toolset_style( $style );
     }
     */
     $scripts = $this->register_scripts(array());
     foreach ($scripts as $script) {
         Types_Asset_Manager::get_instance()->register_toolset_script($script);
     }
 }
Esempio n. 3
0
 /**
  * Initialize the asset manager for script and styles. 
  * 
  * Must be called early, before init, else special measures are needed.
  * 
  * @since 2.0
  */
 public function initialize_scripts_and_styles()
 {
     Types_Asset_Manager::get_instance();
 }
 /**
  * Load various assets needed by the toolset-forms blob.
  *
  * @since 1.9
  */
 private function add_toolset_forms_support()
 {
     // JS and CSS assets related to fields - mostly generic ones.
     wpcf_edit_post_screen_scripts();
     // Needed for fields that have something to do with files
     WPToolset_Field_File::file_enqueue_scripts();
     // Extra enqueuing of media assets needed since WPToolset_Field_File doesn't know about termmeta.
     wp_enqueue_media();
     // We need to append form-specific data for the JS validation script.
     add_action('admin_footer', array($this, 'render_js_validation_data'));
     // Pretend we're about to create new form via toolset-forms, even if we're not going to.
     // This will load some assets needed for image field preview (specifically the 'wptoolset-forms-admin' style).
     // Hacky, but better than re-registering the toolset-forms stylesheet elsewhere.
     $faux_form_bootstrap = new WPToolset_Forms_Bootstrap();
     $faux_form_bootstrap->form('faux');
     $asset_manager = Types_Asset_Manager::get_instance();
     // Enqueue the main page script
     $asset_manager->register_script(self::PAGE_SCRIPT_NAME, TYPES_RELPATH . '/public/page/add_term.js', array('jquery', 'toolset-utils'), TYPES_VERSION, true);
     $asset_manager->enqueue_scripts(self::PAGE_SCRIPT_NAME);
 }
Esempio n. 5
0
/**
 * Menu page hook.
 */
function wpcf_admin_menu_edit_tax_hook()
{
    do_action('wpcf_admin_page_init');
    wp_enqueue_script('wpcf-form-validation', WPCF_RES_RELPATH . '/js/' . 'jquery-form-validation/jquery.validate.min.js', array('jquery'), WPCF_VERSION);
    wp_enqueue_script('wpcf-form-validation-additional', WPCF_RES_RELPATH . '/js/' . 'jquery-form-validation/additional-methods.min.js', array('jquery'), WPCF_VERSION);
    wp_enqueue_script('wpcf-taxonomy-form', WPCF_RES_RELPATH . '/js/' . 'taxonomy-form.js', array('jquery'), WPCF_VERSION);
    // New page controller script.
    $asset_manager = Types_Asset_Manager::get_instance();
    $asset_manager->enqueue_scripts(Types_Asset_Manager::SCRIPT_PAGE_EDIT_TAXONOMY);
    add_action('admin_footer', 'wpcf_admin_tax_form_js_validation');
    require_once WPCF_EMBEDDED_INC_ABSPATH . '/custom-taxonomies.php';
    require_once WPCF_INC_ABSPATH . '/custom-taxonomies-form.php';
    //    $form = wpcf_admin_custom_taxonomies_form();
    require_once WPCF_INC_ABSPATH . '/classes/class.types.admin.edit.taxonomy.php';
    $wpcf_admin = new Types_Admin_Edit_Taxonomy();
    $wpcf_admin->init_admin();
    $form = $wpcf_admin->form();
    wpcf_form('wpcf_form_tax', $form);
}
Esempio n. 6
0
 public function on_admin_enqueue_scripts()
 {
     $main_handle = 'types-page-field-control-main';
     // Enqueuing with the wp-admin dependency because we need to override something !important.
     Types_Asset_Manager::get_instance()->enqueue_styles(array('wp-admin', 'common', 'font-awesome', 'wpcf-css-embedded'));
     wp_enqueue_style($main_handle, TYPES_RELPATH . '/public/page/field_control/style.css');
     wp_enqueue_script($main_handle, TYPES_RELPATH . '/public/page/field_control/main.js', array('jquery', 'backbone', 'headjs', 'underscore', Types_Asset_Manager::SCRIPT_ADJUST_MENU_LINK, Types_Asset_Manager::SCRIPT_KNOCKOUT, Types_Asset_Manager::SCRIPT_DIALOG_BOXES, Types_Asset_Manager::SCRIPT_UTILS), TYPES_VERSION);
 }