Inventory_Presser_Blocks::add_category( array $block_categories, WP_Block_Editor_Context $block_editor_context )

add_category


Description Description

Adds a block category to hold all our blocks


Top ↑

Parameters Parameters

$block_categories

(array) (Required)

$block_editor_context

(WP_Block_Editor_Context) (Required)


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/class-blocks.php

	function add_category( $block_categories, $block_editor_context ) {
		// is the post a vehicle?
		if ( empty( $block_editor_context->post->post_type )
			|| $block_editor_context->post->post_type != INVP::POST_TYPE
		) {
			return $block_categories;
		}

		return array_merge(
			$block_categories,
			array(
				array(
					'slug'  => 'inventory-presser',
					'title' => __( 'Inventory Presser', 'inventory-presser' ),
					'icon'  => 'dashicons-admin-network', // it's a key
				),
			)
		);
	}