CB_Events_Component
extends CB_Component
in package
A component that allows certain users to create and manage company events.
Tags
Table of Contents
Properties
- $admin_menu : array<string|int, mixed>
- WordPress Toolbar links.
- $current_id : string
- The current ID of the queried object.
- $global_tables : array<string|int, mixed>
- Global tables for the component (if applicable).
- $has_directory : bool
- Does the component need a top-level directory?
- $id : string
- Unique ID for the component.
- $meta_tables : array<string|int, mixed>
- Metadata tables for the component (if applicable).
- $name : string
- Translatable name for the component.
- $notification_callback : callable
- Callback for formatting notifications.
- $path : string
- The path to the component's files.
- $query : WP_Query
- The WP_Query loop for this component.
- $root_slug : string
- Root slug for the component.
- $search_query_arg : string
- Query argument for component search URLs.
- $search_string : string
- Placeholder text for component directory search box.
- $slug : string
- Unique slug for the component, for use in query strings and URLs.
Methods
- __construct() : mixed
- Initializes the component.
- add_permastructs() : mixed
- Add any permalink structures.
- add_rewrite_rules() : mixed
- Add any additional rewrite rules.
- add_rewrite_tags() : mixed
- Add any additional rewrite tags.
- enqueue_scripts() : mixed
- Enqueues script for the events component.
- generate_rewrite_rules() : mixed
- Generate any additional rewrite rules.
- includes() : mixed
- Includes required files.
- late_includes() : mixed
- Late includes method.
- parse_query() : mixed
- Allow components to parse the main query.
- register_api_endpoints() : mixed
- Registers API endpoints for events and contests.
- register_global_tables() : mixed
- Register global tables for the component, so that it may use WordPress's database API.
- register_meta_tables() : mixed
- Register component metadata tables.
- register_post_types() : mixed
- Set up the component post types.
- register_scripts() : mixed
- register_taxonomies() : mixed
- Register component-specific taxonomies.
- setup_actions() : mixed
- Set up the actions.
- setup_admin_bar() : mixed
- Set up the component entries in the WordPress Admin Bar.
- setup_cache_groups() : mixed
- Setup component-specific cache groups.
- setup_canonical_stack() : mixed
- Set up the canonical URL stack for this component.
- setup_filters() : mixed
- Sets up filters for redirect shenanigans.
- setup_globals() : mixed
- Sets up component global values.
- setup_nav() : mixed
- Set up component navigation.
- setup_title() : mixed
- Set up the component title.
- start() : mixed
- Component loader.
Properties
$admin_menu
WordPress Toolbar links.
public
array<string|int, mixed>
$admin_menu
= ''
Tags
$current_id
The current ID of the queried object.
public
string
$current_id
= ''
Tags
$global_tables
Global tables for the component (if applicable).
public
array<string|int, mixed>
$global_tables
= array()
Tags
$has_directory
Does the component need a top-level directory?
public
bool
$has_directory
= \false
Tags
$id
Unique ID for the component.
public
string
$id
= ''
Tags
$meta_tables
Metadata tables for the component (if applicable).
public
array<string|int, mixed>
$meta_tables
= array()
Tags
$name
Translatable name for the component.
public
string
$name
= ''
$notification_callback
Callback for formatting notifications.
public
callable
$notification_callback
= ''
Tags
$path
The path to the component's files.
public
string
$path
= ''
Tags
$query
The WP_Query loop for this component.
public
WP_Query
$query
= \false
Tags
$root_slug
Root slug for the component.
public
string
$root_slug
= ''
Tags
$search_query_arg
Query argument for component search URLs.
public
string
$search_query_arg
= 's'
Tags
$search_string
Placeholder text for component directory search box.
public
string
$search_string
= ''
Tags
$slug
Unique slug for the component, for use in query strings and URLs.
public
string
$slug
= ''
Tags
Methods
__construct()
Initializes the component.
public
__construct() : mixed
Tags
add_permastructs()
Add any permalink structures.
public
add_permastructs() : mixed
Tags
add_rewrite_rules()
Add any additional rewrite rules.
public
add_rewrite_rules() : mixed
Tags
add_rewrite_tags()
Add any additional rewrite tags.
public
add_rewrite_tags() : mixed
Tags
enqueue_scripts()
Enqueues script for the events component.
public
enqueue_scripts([mixed $components = [] ]) : mixed
Parameters
- $components : mixed = []
Tags
generate_rewrite_rules()
Generate any additional rewrite rules.
public
generate_rewrite_rules() : mixed
Tags
includes()
Includes required files.
public
includes([mixed $includes = [] ]) : mixed
Parameters
- $includes : mixed = []
-
An array of file names, or file name chunks, to be parsed and then included.
Tags
late_includes()
Late includes method.
public
late_includes() : mixed
Components should include files here only on specific pages using conditionals such as . Intentionally left empty.
Tags
parse_query()
Allow components to parse the main query.
public
parse_query(object $query) : mixed
Parameters
- $query : object
-
The main WP_Query.
Tags
register_api_endpoints()
Registers API endpoints for events and contests.
public
register_api_endpoints([mixed $components = [] ]) : mixed
Parameters
- $components : mixed = []
Tags
register_global_tables()
Register global tables for the component, so that it may use WordPress's database API.
public
register_global_tables([array<string|int, mixed> $tables = array() ]) : mixed
Parameters
- $tables : array<string|int, mixed> = array()
-
Table names to register.
Tags
register_meta_tables()
Register component metadata tables.
public
register_meta_tables([array<string|int, mixed> $tables = array() ]) : mixed
Metadata tables are registered in the $wpdb global, for compatibility with the WordPress metadata API.
Parameters
- $tables : array<string|int, mixed> = array()
-
Table names to register.
Tags
register_post_types()
Set up the component post types.
public
register_post_types() : mixed
Tags
register_scripts()
public
register_scripts([mixed $components = [] ]) : mixed
Parameters
- $components : mixed = []
register_taxonomies()
Register component-specific taxonomies.
public
register_taxonomies() : mixed
Tags
setup_actions()
Set up the actions.
public
setup_actions() : mixed
Tags
setup_admin_bar()
Set up the component entries in the WordPress Admin Bar.
public
setup_admin_bar([array<string|int, mixed> $wp_admin_nav = array() ]) : mixed
Parameters
- $wp_admin_nav : array<string|int, mixed> = array()
-
An array of nav item arguments. Each item in this parameter array is passed to . See that method for a description of the required syntax for each item.
Tags
setup_cache_groups()
Setup component-specific cache groups.
public
setup_cache_groups() : mixed
Tags
setup_canonical_stack()
Set up the canonical URL stack for this component.
public
setup_canonical_stack() : mixed
Tags
setup_filters()
Sets up filters for redirect shenanigans.
public
setup_filters() : mixed
Tags
setup_globals()
Sets up component global values.
public
setup_globals([mixed $args = [] ]) : mixed
Parameters
- $args : mixed = []
-
{ All values are optional. @type string $slug The component slug. Used to construct certain URLs, such as 'friends' in http://example.com/members/joe/friends/. Default: the value of $this->id. @type string $root_slug The component root slug. Note that this value is generally unused if the component has a root directory (the slug will be overridden by the post_name of the directory page). Default: the slug of the directory page if one is found, otherwise an empty string. @type bool $has_directory Set to true if the component requires an associated WordPress page. @type callable $notification_callback Optional. The callable function that formats the component's notifications. @type string $search_term Optional. The placeholder text in the component directory search box. Eg, 'Search Groups...'. @type array $global_tables Optional. An array of database table names. @type array $meta_tables Optional. An array of metadata table names. }
Tags
setup_nav()
Set up component navigation.
public
setup_nav([array<string|int, mixed> $main_nav = array() ][, array<string|int, mixed> $sub_nav = array() ]) : mixed
Maybe we'll use this someday.
Parameters
- $main_nav : array<string|int, mixed> = array()
-
Optional. Passed directly to cb_core_new_nav_item(). See that function for a description.
- $sub_nav : array<string|int, mixed> = array()
-
Optional. Multidimensional array, each item in which is passed to cb_core_new_subnav_item(). See that function for a description.
Tags
setup_title()
Set up the component title.
public
setup_title() : mixed
Tags
start()
Component loader.
public
start([string $id = '' ][, string $name = '' ][, string $path = '' ][, array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $id : string = ''
-
Unique ID. Letters, numbers, and underscores only.
- $name : string = ''
-
Unique name. This should be a translatable name, eg. __( 'Groups', 'confetti_bits' ).
- $path : string = ''
-
- $params : array<string|int, mixed> = array()
-
{ Additional parameters used by the component. @type int $adminbar_myaccount_order Set the position for our menu under the WP Toolbar's "My Account menu". @type array $features An array of feature names. This is used to load additional files from your component directory and for feature active checks. eg. array( 'awesome' ) would look for a file called "cb-{$this->id}-awesome.php" and you could use cb_is_active( $this->id, 'awesome' ) to determine if the feature is active. @type string $search_query_arg String to be used as the query argument in component search URLs. }