Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#41786 closed enhancement (wontfix)

Action introduction before button to save customizer settings data.

Reported by: collizo4sky's profile Collizo4sky Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4
Component: Customize Keywords:
Focuses: ui, administration Cc:

Description

In a project I am working on, we need to add an icon indication before the "Save & Publish" customizer button.

This patch introduces an Action before the button.

Attachments (1)

customize-header-actions.patch (646 bytes) - added by Collizo4sky 8 years ago.

Download all attachments as: .zip

Change History (8)

#1 @Collizo4sky
8 years ago

Can you please commit this @westonruter 🙏

#2 @westonruter
8 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

@Collizo4sky hi, for this you'll want to use JavaScript to add the desired element to the Customizer. You may refer to the Customize Snapshots plugin for an example. You can see that this addButtons function gets called in a wp.customize.bind( 'ready, ... ) event callback.

#3 @Collizo4sky
8 years ago

@westonruter But there is no harm in adding an action there. What can possibly go wrong?

Last edited 8 years ago by Collizo4sky (previous) (diff)

#4 @westonruter
8 years ago

Actions and filters should only be added where required, when there is no alternative solution or established practice in place. Otherwise, it just adds bloat to WordPress.

#5 @Collizo4sky
8 years ago

@westonruter Not everyone is that great with JavaScript. Adding an action will make our life easier compared to going the javascript route. WordPress has lot's of actions and filters already, I don't see adding just one more reducing the bloat-ness of WordPress.

Kindly please reconsider your stance on this. I am sure a lot of persons who need to add something before the button will prefer this over the JS solution you linked to above.

Last edited 8 years ago by Collizo4sky (previous) (diff)

#6 @westonruter
8 years ago

@Collizo4sky Here is a simple standalone example for what you can do without adding a new action:

<?php
add_action( 'customize_controls_print_footer_scripts', function() {
        ?>
        <script>
                jQuery( function( $ ) {
                        $( '#customize-header-actions' ).prepend( $( '<span>Hello!</span>' ) );
                } );
        </script>
        <?php
} );

#7 @Collizo4sky
8 years ago

Thanks for the code snippet.

Note: See TracTickets for help on using tickets.