PHP Class Carbon_Fields\Container\Nav_Menu_Container

Inheritance: extends Container
显示文件 Open project: htmlburger/carbon-fields

Public Properties

Property Type Description
$active_containers
$initialized
$instances

Public Methods

Method Description
__construct ( string $id ) Create a new nav menu item fields container
edit_walker ( ) Setup custom walker for the Nav Menu entries
form ( $item ) Render custom fields inside each Nav Menu entry
get_containers ( ) Get containers only once, and store in instance memory.
init ( integer $menu_id, boolean $render = true ) Perform instance initialization after calling setup()
initialize_filters ( ) Initialize filters. This will be executed only once
is_valid_attach ( ) TODO: make sure the containers for nav menus are not printed everywhere
is_valid_save ( ) : boolean Checks whether the current request is valid
render ( ) Output the container markup
save ( $user_data = null ) Perform save operation after successful is_valid_save() check.
set_instance_for_id ( $current_menu_item_id, $render = true ) Render attribute prevents field containers showing on menu save
set_menu_id ( integer $menu_id ) Set the menu item ID the container will operate with.
to_json ( boolean $load ) : array Returns an array that holds the container data, suitable for JSON representation.
update ( $menu_id, $current_menu_item_id ) Trigger Save for all instances

Method Details

__construct() public method

Create a new nav menu item fields container
public __construct ( string $id )
$id string ID of the container

edit_walker() public static method

Setup custom walker for the Nav Menu entries
public static edit_walker ( )

form() public static method

Render custom fields inside each Nav Menu entry
public static form ( $item )

get_containers() public static method

Get containers only once, and store in instance memory.
public static get_containers ( )

init() public method

Perform instance initialization after calling setup()
public init ( integer $menu_id, boolean $render = true )
$menu_id integer Used to pass the correct menu_item_id to the Container object
$render boolean Whether the container will render the fields.

initialize_filters() public static method

Initialize filters. This will be executed only once
public static initialize_filters ( )

is_valid_attach() public method

TODO: make sure the containers for nav menus are not printed everywhere
public is_valid_attach ( )

is_valid_save() public method

Checks whether the current request is valid
public is_valid_save ( ) : boolean
return boolean

render() public method

Output the container markup
public render ( )

save() public method

The call is propagated to all fields in the container.
public save ( $user_data = null )

set_instance_for_id() public static method

Render attribute prevents field containers showing on menu save
public static set_instance_for_id ( $current_menu_item_id, $render = true )

set_menu_id() public method

Set the menu item ID the container will operate with.
public set_menu_id ( integer $menu_id )
$menu_id integer

to_json() public method

This data will be available in the Underscore template and the Backbone Model.
public to_json ( boolean $load ) : array
$load boolean Should the value be loaded from the database or use the value from the current instance.
return array

update() public static method

Trigger Save for all instances
public static update ( $menu_id, $current_menu_item_id )

Property Details

$active_containers public_oe static_oe property

public static $active_containers

$initialized public_oe static_oe property

public static $initialized

$instances public_oe static_oe property

public static $instances