';
// Add page title, with drag handle and expand/collapse button.
$drag_handle = '
';
$toggle_button = sprintf(
'
',
( $has_children ? '' : 'disabled' )
);
$title_link = sprintf(
'
%s',
esc_url( (string) get_permalink( $page->ID ) ),
apply_filters( 'the_title', $page->post_title, $page->ID )
);
$output .= sprintf(
'
%s%s%s',
current_user_can( 'publish_pages' ) ? $drag_handle : '',
$toggle_button,
$title_link
);
// Add contributor info.
$contributors = $this->get_contributor_info( $page->ID );
$output .= sprintf(
'
%s',
$contributors
);
// Add date modified.
$date_format = get_option( 'date_format' );
if ( empty( $date_format ) ) {
$date_format = 'M j, Y';
}
$post_modified = (string) mysql2date( $date_format, $page->post_modified ) . '';
$output .= sprintf(
'
%s',
$post_modified
);
// Add post actions.
$wrapper_class = 'p2020-pages-index__post-actions o2-dropdown-actions';
$output .= self::get_post_actions_menu( $page->ID, $wrapper_class );
// Close item details wrapper.
$output .= '
';
}
private function get_post_actions_menu( int $page_id, string $wrapper_class ): string {
$editor_page_url = Navigation\Urls::get_editor_page_url();
$new_page_link = $editor_page_url .
( wp_parse_url( $editor_page_url, PHP_URL_QUERY ) ? '&' : '?' ) .
'parent_post=' . $page_id;
$new_page_label = __( 'Add subpage', 'p2020' );
$permalink = \get_permalink( $page_id );
$permalink_label = __( 'Copy link', 'p2020' );
/* Translators: verb, synonym of "delete" */
$trash_link = admin_url( 'post.php?action=trash&post=' . $page_id );
$trash_label = __( 'Trash', 'p2020' );
$menu_items = "