WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/16/2012 02:02:28 PM (7 years ago)
Author:
koopersmith
Message:

Theme Customizer: Allow the customize iframe to be accessed directly (with full feature support). see #19910.

  • Move the 'Return to Manage Themes' and 'Collapse Sidebar' actions from themes.php to customize-controls.php.
  • Create a postMessage connection between themes.php and customize-controls.php.
  • Allow the theme customizer to be accessed directly (independent of themes.php and the customize loader).
  • Add wp_customize_href() and wp_customize_url().
  • Remove wp_customize_loader(). To include the loader, use wp_enqueue_script( 'customize-loader' ).
  • The theme customizer now requires postMessage browser support.
  • Add .hide-if-customize and .hide-if-no-customize CSS classes.
  • Clean up customize-preview.js.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r20419 r20476  
    15841584
    15851585/**
    1586  * Includes the loading scripts for the theme customizer and
    1587  * adds the action to print the customize container template.
     1586 * Localizes the customize-loader script.
    15881587 *
    15891588 * @since 3.4.0
    15901589 */
    1591 function wp_customize_loader() {
    1592     wp_enqueue_script( 'customize-loader' );
    1593     add_action( 'admin_footer', '_wp_customize_loader_template' );
    1594 }
    1595 
    1596 /**
    1597  * Print the customize container template.
     1590function _wp_customize_loader_localize() {
     1591    wp_localize_script( 'customize-loader', 'wpCustomizeLoaderL10n', array(
     1592        'back' => sprintf( __( '← Return to %s' ), get_admin_page_title() ),
     1593    ) );
     1594}
     1595add_action( 'admin_enqueue_scripts', '_wp_customize_loader_localize' );
     1596
     1597/**
     1598 * Returns a URL to load the theme customizer.
    15981599 *
    15991600 * @since 3.4.0
    16001601 */
    1601 function _wp_customize_loader_template() {
    1602     ?>
    1603     <div id="customize-container" class="wp-full-overlay">
    1604         <input type="hidden" class="admin-url" value="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>" />
    1605         <a href="#" class="close-full-overlay"><?php printf( __( '&larr; Return to %s' ), get_admin_page_title() ); ?></a>
    1606         <a href="#" class="collapse-sidebar button-secondary" title="<?php esc_attr_e('Collapse Sidebar'); ?>">
    1607             <span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span>
    1608             <span class="collapse-sidebar-arrow"></span>
    1609         </a>
    1610     </div>
    1611     <?php
    1612 }
     1602function wp_customize_url( $template, $stylesheet = null ) {
     1603    $stylesheet = isset( $stylesheet ) ? $stylesheet : $template;
     1604    return admin_url( 'admin.php' ) . '?customize=on&template=' . $template . '&stylesheet=' . $stylesheet;
     1605}
     1606
     1607/**
     1608 * Prints an href attribute to load the theme customizer.
     1609 *
     1610 * @since 3.4.0
     1611 */
     1612function wp_customize_href( $template, $stylesheet = null ) {
     1613    $link = wp_customize_url( $template, $stylesheet );
     1614    return 'href="' . esc_url( $link ) . '"';
     1615}
Note: See TracChangeset for help on using the changeset viewer.