Feature / Add edit in customizer buttons#140
Conversation
php/class-edit-post-preview.php
Outdated
| $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.
What about other plugins that add action links? I think an array_merge() is required.
php/class-edit-post-preview.php
Outdated
| * @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.
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;
}
php/class-edit-post-preview.php
Outdated
| * @return string $customize_url | ||
| */ | ||
| public function get_customize_url( $post = null ) { | ||
| if ( ! is_a( $post, 'WP_Post' ) ) { |
There was a problem hiding this comment.
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 Customizerbutton to the Posts/Pages edit screens. As well as addingEdit in Customizerto bothpost_row_actionsandpage_row_actions. I moved thecustomize urlinto it's own function since we're calling it in two different functions now.