wpseek.com
A WordPress-centric search engine for devs and theme authors



_wp_get_entity_view_config_posttype_page › WordPress Function

Since7.1.0
Deprecatedn/a
_wp_get_entity_view_config_posttype_page ( $data )
Parameters:
  • (WP_View_Config_Data) $data The view configuration container for the entity.
    Required: Yes
Returns:
  • (WP_View_Config_Data) The updated view configuration container.
Defined at:
Codex:

Provides the view configuration for the `page` post type.



Source

function _wp_get_entity_view_config_posttype_page( $data ) {
	$default_layouts = array(
		'table' => array(
			'layout' => array(
				'styles' => array(
					'author' => array(
						'align' => 'start',
					),
				),
			),
		),
		'grid'  => array(),
		'list'  => array(),
	);

	$default_view = array(
		'type'       => 'list',
		'filters'    => array(),
		'perPage'    => 20,
		'sort'       => array(
			'field'     => 'title',
			'direction' => 'asc',
		),
		'showLevels' => true,
		'titleField' => 'title',
		'mediaField' => 'featured_media',
		'fields'     => array( 'author', 'status' ),
	);

	$view_list = array(
		array(
			'title' => __( 'Published' ),
			'slug'  => 'published',
			'view'  => array(
				'filters' => array(
					array(
						'field'    => 'status',
						'operator' => 'isAny',
						'value'    => 'publish',
						'isLocked' => true,
					),
				),
			),
		),
		array(
			'title' => __( 'Scheduled' ),
			'slug'  => 'future',
			'view'  => array(
				'filters' => array(
					array(
						'field'    => 'status',
						'operator' => 'isAny',
						'value'    => 'future',
						'isLocked' => true,
					),
				),
			),
		),
		array(
			'title' => __( 'Drafts' ),
			'slug'  => 'drafts',
			'view'  => array(
				'filters' => array(
					array(
						'field'    => 'status',
						'operator' => 'isAny',
						'value'    => 'draft',
						'isLocked' => true,
					),
				),
			),
		),
		array(
			'title' => __( 'Pending' ),
			'slug'  => 'pending',
			'view'  => array(
				'filters' => array(
					array(
						'field'    => 'status',
						'operator' => 'isAny',
						'value'    => 'pending',
						'isLocked' => true,
					),
				),
			),
		),
		array(
			'title' => __( 'Private' ),
			'slug'  => 'private',
			'view'  => array(
				'filters' => array(
					array(
						'field'    => 'status',
						'operator' => 'isAny',
						'value'    => 'private',
						'isLocked' => true,
					),
				),
			),
		),
		array(
			'title' => __( 'Trash' ),
			'slug'  => 'trash',
			'view'  => array(
				'type'    => 'table',
				'layout'  => $default_layouts['table']['layout'],
				'filters' => array(
					array(
						'field'    => 'status',
						'operator' => 'isAny',
						'value'    => 'trash',
						'isLocked' => true,
					),
				),
			),
		),
	);

	$data->set(
		array(
			'default_view'    => $default_view,
			'default_layouts' => $default_layouts,
		),
		1
	);
	// Append the status views, thereby preserving the base "all items" view,
	// so its post-type-specific title is kept.
	$data->merge( array( 'view_list' => $view_list ), 1 );

	return $data;
}