Revisions: add a `'wp_prepare_revision_for_js'` filter.

Props jtsternberg, adamsilverstein.
Fixes #28627.

Built from https://develop.svn.wordpress.org/trunk@34541


git-svn-id: http://core.svn.wordpress.org/trunk@34505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-25 14:04:24 +00:00
parent 1de01f31bc
commit 8a8e6557d0
2 changed files with 12 additions and 2 deletions

View File

@ -199,7 +199,7 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null
$current_id = $revision->ID; $current_id = $revision->ID;
} }
$revisions[ $revision->ID ] = array( $revisions_data = array(
'id' => $revision->ID, 'id' => $revision->ID,
'title' => get_the_title( $post->ID ), 'title' => get_the_title( $post->ID ),
'author' => $authors[ $revision->post_author ], 'author' => $authors[ $revision->post_author ],
@ -210,6 +210,16 @@ function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null
'current' => $current, 'current' => $current,
'restoreUrl' => $can_restore ? $restore_link : false, 'restoreUrl' => $can_restore ? $restore_link : false,
); );
/**
* Filter the array of revisions used on the revisions screen.
*
* @since 4.4.0
*
* @param array $revisions_data The bootstrapped data for the revisions screen.
* @param WP_Post $post The revision's parent WP_Post object.
*/
$revisions[ $revision->ID ] = apply_filters( 'wp_prepare_revision_for_js', $revisions_data, $post );
} }
/** /**

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34540'; $wp_version = '4.4-alpha-34541';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.