Page::get_bulk_action_messages( array $request_data = array() )

Get the messaging for single or bulk actions.

This was largely lifted from wp-admin/edit.php (hence the lack of textdomains.


Parameters

$request_data

(array) (Optional) REQUEST data.

Default value: array()


Top ↑

Return

(array)


Top ↑

Source

File: src/Tribe/Admin/Manager/Page.php

	public function get_bulk_action_messages( $request_data = [] ) {
		$bulk_counts = [
			'updated'   => isset( $request_data['updated'] ) ? absint( $request_data['updated'] ) : 0,
			'locked'    => isset( $request_data['locked'] ) ? absint( $request_data['locked'] ) : 0,
			'deleted'   => isset( $request_data['deleted'] ) ? absint( $request_data['deleted'] ) : 0,
			'trashed'   => isset( $request_data['trashed'] ) ? absint( $request_data['trashed'] ) : 0,
			'untrashed' => isset( $request_data['untrashed'] ) ? absint( $request_data['untrashed'] ) : 0,
		];

		$bulk_messages             = [];
		$bulk_messages['post']     = [
			/* translators: %s: Number of posts. */
			'updated'   => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ),
			'locked'    => ( 1 === $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) :
				/* translators: %s: Number of posts. */
				_n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
			/* translators: %s: Number of posts. */
			'deleted'   => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ),
			/* translators: %s: Number of posts. */
			'trashed'   => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ),
			/* translators: %s: Number of posts. */
			'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ),
		];

		/**
		 * Filters the bulk action updated messages.
		 *
		 * By default, custom post types use the messages for the 'post' post type.
		 *
		 * Note: This filter is not prefixed by tribe_ or tec_ because it is the filter from wp-admin/edit.php.
		 *
		 * @since WP 3.7.0
		 *
		 * @param array[] $bulk_messages Arrays of messages, each keyed by the corresponding post type. Messages are
		 *                               keyed with 'updated', 'locked', 'deleted', 'trashed', and 'untrashed'.
		 * @param int[]   $bulk_counts   Array of item counts for each message, used to build internationalized strings.
		 */
		$bulk_messages = apply_filters( 'bulk_post_updated_messages', $bulk_messages, $bulk_counts );
		$bulk_counts   = array_filter( $bulk_counts );

		return [
			'bulk_messages' => $bulk_messages,
			'bulk_counts'   => $bulk_counts
		];
	}

Top ↑

Changelog

Changelog
Version Description
5.9.0 Introduced.