-
Notifications
You must be signed in to change notification settings - Fork 37
Feature / Add edit in customizer buttons #140
base: develop
Are you sure you want to change the base?
Conversation
$rebuild_actions['edit_customizer'] = '<a href="' . esc_html( self::get_customize_url( $post ) ) . '">Edit in Customizer</a>'; | ||
$rebuild_actions['inline hide-if-no-js'] = $actions['inline hide-if-no-js']; | ||
$rebuild_actions['trash'] = $actions['trash']; | ||
$rebuild_actions['view'] = $actions['view']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about other plugins that add action links? I think an array_merge()
is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@westonruter definitely.
* @return array $rebuild_actions | ||
*/ | ||
public function add_edit_customizer_to_row_actions( $actions, $post ) { | ||
if ( ! is_a( $post, 'WP_Post' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's be consistent and use the same coding style. Other places in the plugin we would check if $post
is an instance of WP_Post
like this:
if ( ! ( $post instanceof WP_Post ) ) {
return false;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@valendesigns Thanks I've now fixed it.
* @return string $customize_url | ||
*/ | ||
public function get_customize_url( $post = null ) { | ||
if ( ! is_a( $post, 'WP_Post' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one could also be updated.
@westonruter and @valendesigns This is ready for another look at. Any comments/direction would be good. As far as I can tell this is working the way we want it to, however I'm open to making this work better. |
@stuartshields It appears you could just do away with the |
@valendesigns I wasn't able to get rid of get_customize_url altogether as it still needs the other variables that are generated to work. Latest commit has the fix, if you wanted to have a look. |
@stuartshields The post object is all you need to generate the preview URL so you can totally replace the |
@valendesigns I guess I'm concerned about not using |
Release 0.6.1
Fix build for 0.6.1
Fix location of readme change
@stuartshields I've updated the PR a bit and resolved conflicts. All that's left is to add unit test coverage for the new methods. |
@westonruter and @valendesigns here is the initial concept for adding the
Edit in Customizer
button to the Posts/Pages edit screens. As well as addingEdit in Customizer
to bothpost_row_actions
andpage_row_actions
. I moved thecustomize url
into it's own function since we're calling it in two different functions now.