Confetti Bits

CB_Requests_Component extends CB_Component
in package

A component class that gives us access to important globals throughout the app.

Lets us set some global values to use elsewhere.

Tags
since
2.3.0

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 requests 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 scripts for the requests 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 the requests component.
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 component globals for the requests component.
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
since
1.0.0

$current_id

The current ID of the queried object.

public string $current_id = ''
Tags
since
1.0.0

$global_tables

Global tables for the component (if applicable).

public array<string|int, mixed> $global_tables = array()
Tags
since
1.0.0

$has_directory

Does the component need a top-level directory?

public bool $has_directory = \false
Tags
since
1.0.0

$meta_tables

Metadata tables for the component (if applicable).

public array<string|int, mixed> $meta_tables = array()
Tags
since
1.0.0

$notification_callback

Callback for formatting notifications.

public callable $notification_callback = ''
Tags
since
1.0.0

$path

The path to the component's files.

public string $path = ''
Tags
since
1.0.0

$query

The WP_Query loop for this component.

public WP_Query $query = \false
Tags
since
1.0.0

$root_slug

Root slug for the component.

public string $root_slug = ''
Tags
since
1.0.0

$search_query_arg

Query argument for component search URLs.

public string $search_query_arg = 's'
Tags
since
1.0.0

$search_string

Placeholder text for component directory search box.

public string $search_string = ''
Tags
since
1.0.0

$slug

Unique slug for the component, for use in query strings and URLs.

public string $slug = ''
Tags
since
1.0.0

Methods

add_permastructs()

Add any permalink structures.

public add_permastructs() : mixed
Tags
since
1.0.0

add_rewrite_rules()

Add any additional rewrite rules.

public add_rewrite_rules() : mixed
Tags
since
1.0.0

add_rewrite_tags()

Add any additional rewrite tags.

public add_rewrite_tags() : mixed
Tags
since
1.0.0

enqueue_scripts()

Enqueues scripts for the requests component.

public enqueue_scripts([mixed $components = [] ]) : mixed
Parameters
$components : mixed = []
Tags
since
3.0.0

generate_rewrite_rules()

Generate any additional rewrite rules.

public generate_rewrite_rules() : mixed
Tags
since
1.0.0

includes()

Includes required files.

public includes([mixed $includes = array() ]) : mixed
Parameters
$includes : mixed = array()

An array of file names, or file name chunks, to be parsed and then included.

Tags
since
2.3.0

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
since
1.0.0

parse_query()

Allow components to parse the main query.

public parse_query(object $query) : mixed
Parameters
$query : object

The main WP_Query.

Tags
since
1.0.0

register_api_endpoints()

Registers API endpoints for the requests component.

public register_api_endpoints([mixed $components = [] ]) : mixed
Parameters
$components : mixed = []
Tags
since
2.3.1

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
since
1.0.0

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
since
1.0.0

register_post_types()

Set up the component post types.

public register_post_types() : mixed
Tags
since
1.0.0

register_scripts()

public register_scripts([mixed $components = [] ]) : mixed
Parameters
$components : mixed = []

register_taxonomies()

Register component-specific taxonomies.

public register_taxonomies() : mixed
Tags
since
1.0.0

setup_actions()

Set up the actions.

public setup_actions() : mixed
Tags
since
1.0.0

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
since
1.0.0
see
WP_Admin_Bar::add_menu()

for a description of the syntax required by each item in the $wp_admin_nav parameter array.

global

object $wp_admin_bar

setup_cache_groups()

Setup component-specific cache groups.

public setup_cache_groups() : mixed
Tags
since
1.0.0

setup_canonical_stack()

Set up the canonical URL stack for this component.

public setup_canonical_stack() : mixed
Tags
since
1.0.0

setup_filters()

Sets up filters for redirect shenanigans.

public setup_filters() : mixed
Tags
since
3.0.0

setup_globals()

Sets component globals for the requests component.

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
since
2.3.0

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
since
1.0.0
see
cb_core_new_nav_item()

For a description of the $main_nav parameter formatting.

see
cb_core_new_subnav_item()

For a description of how each item in the $sub_nav parameter array should be formatted.

setup_title()

Set up the component title.

public setup_title() : mixed
Tags
since
1.0.0

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 = ''

The file path for the component's files. Used by .

$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. }

Tags
since
1.0.0

        
On this page

Search results