Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#41786 closed enhancement (wontfix)

Action introduction before button to save customizer settings data.

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

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 9 years ago.

Download all attachments as: .zip

Change History (8)

#1 @Collizo4sky
9 years ago

Can you please commit this @westonruter 🙏

#2 @westonruter
9 years ago

  • Milestone Awaiting Review
  • Resolution → wontfix
  • Status new → 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
9 years ago

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

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

#4 @westonruter
9 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
9 years ago

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.

Version 0, edited 9 years ago by Collizo4sky (next)

#6 @westonruter
9 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
9 years ago

Thanks for the code snippet.

Note: See TracTickets for help on using tickets.