PHP Class fewbricks\acf\field_group

ファイルを表示 Open project: folbert/fewbricks Class Usage Examples

Public Methods

Method Description
__construct ( string $title, string $key, array $location, integer $menu_order = 1, array $settings = [] )
add_brick ( brick $brick )
add_common_field ( string $common_field_array_key, string $key, array $settings = [] )
add_field ( field $field )
add_flexible_content ( flexible_content $flexible_content ) : flexible_content
get_setting ( $key, string $default_value = '' ) : string
get_settings ( ) : array
print_settings ( )
register ( ) Register a field group.
set_setting ( $key, $value )

Private Methods

Method Description
check_keys ( $fields ) Checks for duplicate keys. This functions hould not be called in a production environment since it will cause wp_die if a duplicate key is found and will also slow down performance by looping lots of multidimensional arrays.
get_hide_on_screen_settings ( boolean | array $names_of_items_to_hide = false, boolean | array $names_of_items_to_show = false ) : array This function hides and/or removes items on the edit screen for where the field group is present.
get_rabbit_hole_array_key ( array $field_settings ) : boolean | string
save_json ( ) Write settings to json file
set_unique_keys ( $fields, $base_key ) : mixed In order to create unique keys, we prepend teh key of a parent to its kids and so on down the field settings tree.

Method Details

__construct() public method

public __construct ( string $title, string $key, array $location, integer $menu_order = 1, array $settings = [] )
$title string The text to be displayed as title to the administrator.
$key string This must be unique across the site. A god idea is to use the current time and then add a random character. Like so: 1509011031t for September 1st, 2015 @ 10:31.
$location array Where the field group should be displayed.
$menu_order integer Where the field group should be positioned.
$settings array This allows us to set any setting that a field group can have. See $base_settins for available options.

add_brick() public method

public add_brick ( brick $brick )
$brick fewbricks\bricks\brick

add_common_field() public method

public add_common_field ( string $common_field_array_key, string $key, array $settings = [] )
$common_field_array_key string A key corresponding to an item in the fewbricks_common_fields array
$key string A site wide unique key for the field
$settings array Anye extra settings to set on the field. Can be used to override existing settings as well.

add_field() public method

public add_field ( field $field )
$field fewbricks\acf\fields\field

add_flexible_content() public method

public add_flexible_content ( flexible_content $flexible_content ) : flexible_content
$flexible_content fewbricks\acf\fields\flexible_content
return fewbricks\acf\fields\flexible_content

get_setting() public method

public get_setting ( $key, string $default_value = '' ) : string
$key
$default_value string
return string

get_settings() public method

public get_settings ( ) : array
return array

print_settings() public method

public print_settings ( )

register() public method

Register a field group.
public register ( )

set_setting() public method

public set_setting ( $key, $value )
$key
$value