+ $GLOBALS['post'] = $global_post;
+ }
+
+ /**
+ * Gets the name of the default primary column.
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @return string Name of the default primary column, in this case, 'title'.
+ */
+ protected function get_default_primary_column_name() {
+ return 'title';
+ }
+
+ /**
+ * Generates and displays row action links.
+ *
+ * @since 4.3.0
+ * @access protected
+ *
+ * @param object $post Post being acted upon.
+ * @param string $column_name Current column name.
+ * @param string $primary Primary column name.
+ * @return string Row actions output for posts.
+ */
+ protected function handle_row_actions( $post, $column_name, $primary ) {
+ if ( $primary !== $column_name ) {
+ return '';
+ }
+
+ $post_type_object = get_post_type_object( $post->post_type );
+ $can_edit_post = current_user_can( 'edit_post', $post->ID );
+ $actions = array();
+ $title = _draft_or_post_title();
+
+ if ( $can_edit_post && 'trash' != $post->post_status ) {
+ $actions['edit'] = sprintf(
+ '<a href="%s" aria-label="%s">%s</a>',
+ get_edit_post_link( $post->ID ),
+ /* translators: %s: post title */
+ esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ),
+ __( 'Edit' )
+ );
+ $actions['inline hide-if-no-js'] = sprintf(
+ '<a href="#" class="editinline" aria-label="%s">%s</a>',
+ /* translators: %s: post title */
+ esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $title ) ),
+ __( 'Quick Edit' )
+ );
+ }
+
+ if ( current_user_can( 'delete_post', $post->ID ) ) {
+ if ( 'trash' === $post->post_status ) {
+ $actions['untrash'] = sprintf(
+ '<a href="%s" aria-label="%s">%s</a>',
+ wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ),
+ /* translators: %s: post title */
+ esc_attr( sprintf( __( 'Restore “%s” from the Trash' ), $title ) ),
+ __( 'Restore' )
+ );
+ } elseif ( EMPTY_TRASH_DAYS ) {
+ $actions['trash'] = sprintf(
+ '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
+ get_delete_post_link( $post->ID ),
+ /* translators: %s: post title */
+ esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $title ) ),
+ _x( 'Trash', 'verb' )
+ );
+ }
+ if ( 'trash' === $post->post_status || ! EMPTY_TRASH_DAYS ) {
+ $actions['delete'] = sprintf(
+ '<a href="%s" class="submitdelete" aria-label="%s">%s</a>',
+ get_delete_post_link( $post->ID, '', true ),
+ /* translators: %s: post title */
+ esc_attr( sprintf( __( 'Delete “%s” permanently' ), $title ) ),
+ __( 'Delete Permanently' )
+ );
+ }
+ }
+
+ if ( is_post_type_viewable( $post_type_object ) ) {
+ if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
+ if ( $can_edit_post ) {
+ $preview_link = get_preview_post_link( $post );
+ $actions['view'] = sprintf(
+ '<a href="%s" rel="permalink" aria-label="%s">%s</a>',
+ esc_url( $preview_link ),
+ /* translators: %s: post title */
+ esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ),
+ __( 'Preview' )
+ );
+ }
+ } elseif ( 'trash' != $post->post_status ) {
+ $actions['view'] = sprintf(
+ '<a href="%s" rel="permalink" aria-label="%s">%s</a>',
+ get_permalink( $post->ID ),
+ /* translators: %s: post title */
+ esc_attr( sprintf( __( 'View “%s”' ), $title ) ),
+ __( 'View' )
+ );
+ }
+ }
+
+ if ( is_post_type_hierarchical( $post->post_type ) ) {
+
+ /**
+ * Filters the array of row action links on the Pages list table.
+ *
+ * The filter is evaluated only for hierarchical post types.
+ *
+ * @since 2.8.0
+ *
+ * @param array $actions An array of row action links. Defaults are
+ * 'Edit', 'Quick Edit', 'Restore, 'Trash',
+ * 'Delete Permanently', 'Preview', and 'View'.
+ * @param WP_Post $post The post object.
+ */
+ $actions = apply_filters( 'page_row_actions', $actions, $post );
+ } else {
+
+ /**
+ * Filters the array of row action links on the Posts list table.
+ *
+ * The filter is evaluated only for non-hierarchical post types.
+ *
+ * @since 2.8.0
+ *
+ * @param array $actions An array of row action links. Defaults are
+ * 'Edit', 'Quick Edit', 'Restore, 'Trash',
+ * 'Delete Permanently', 'Preview', and 'View'.
+ * @param WP_Post $post The post object.
+ */
+ $actions = apply_filters( 'post_row_actions', $actions, $post );
+ }
+
+ return $this->row_actions( $actions );