Make WordPress Core

Ticket #28627: 28627-2.diff

File 28627-2.diff, 1.1 KB (added by jtsternberg, 12 years ago)

Filter revision array

  • wp-admin/includes/revision.php

     
    164164                        $current_id = $revision->ID;
    165165                }
    166166
    167                 $revisions[ $revision->ID ] = array(
     167                $revision_model_object = array(
    168168                        'id'         => $revision->ID,
    169169                        'title'      => get_the_title( $post->ID ),
    170170                        'author'     => $authors[ $revision->post_author ],
     
    175175                        'current'    => $current,
    176176                        'restoreUrl' => $can_restore ? $restore_link : false,
    177177                );
     178
     179                /**
     180                 * Filter the revision model array used for the revisions JS.
     181                 *
     182                 * @since 4.0.0
     183                 *
     184                 * @param array   $revision_model_object The revision model object for JS
     185                 * @param WP_Post $post                  The original post object which owns this revision
     186                 */
     187                $revisions[ $revision->ID ] = apply_filters( 'wp_prepare_revision_for_js', $revision_model_object, $post );
     188
    178189        }
    179190
    180191        // If a post has been saved since the last revision (no revisioned fields were changed)