Skip to content

Declarations

Loïc Antignac edited this page May 17, 2022 · 6 revisions

Declaration

The array is an associative array with 3 main keys: entity, labels, and settings:

[
	'entity'   => 'Webaxones\Core\Classification\PostType',
	'labels'   => [
	],
	'settings' => [
	],
];
  • The entity key defines the entity to create by passing the class name. (Classes are listed in the table below)
  • The labels key passes all of the entity's labels requiring internationalization.
  • The settings key passes all the parameters the entity needs to be processed.      

List of entity classes

Entity Class
Custom Post Type Webaxones\Core\Classification\PostType
Custom Taxonomy Webaxones\Core\Classification\Taxonomy
ACF Option Page Webaxones\Core\Option\AcfOptionsPage
Native Option Page Webaxones\Core\Option\OptionsPage
Group of settings Webaxones\Core\Option\SettingGroup
Custom Role Webaxones\Core\Role\Role
Custom Block Category Webaxones\Core\Editor\Categories\BlockCategory
Custom Block Pattern Category Webaxones\Core\Editor\Categories\BlockPatternCategory

Labels

The labels key contains all the labels of the entity so that they are internationalizable. For the Custom Post Types and Custom Taxonomy entities, the labels have a gender parameter which by default is m (masculine) and allows messages to be personalized.

When an entity contains sub-elements, such as groups of settings, keys located in settings make it possible to make the link with the labels.

Settings

The settings part always starts with a slug key which identifies the entity.

Most of the time, settings take the arguments requested by the native WordPress function on which the code is based.
When this is not the case or when elements have been added, refer to the page dedicated to the entity via the menu in the sidebar of the wiki.
When a custom key is optional, it must still be declared but with an empty value.

Clone this wiki locally