Property | Type | Description | |
---|---|---|---|
$args | A place to store arbitrary arguments. | ||
$data | Data for the brick | ||
$get_html_args | Extra settings that is passed to get_html() / get_brick_html() | ||
$is_layout | True if the brick is a layout for flexible content | ||
$is_option | True if the brick belongs to an ACF options page. | ||
$is_sub_brick | True if the brick is sub brick of another brick. | ||
$is_sub_field | True if the brick is a sub field for a repeater | ||
$settings | Extra settings to allow for greater flexibility for the arguments. |
Method | Description | |
---|---|---|
__construct ( string $name, string $key = '' ) | ||
add_brick_layout ( string $brick_layout ) | Add a single layout to the brick. String with the name of the layout (without .php). | |
add_css_class ( $class_name ) | Old code that could cause trouble if removed now since people may be using it. | |
add_fields ( $fields_to_add ) | ||
get_arg ( string $name, boolean $default = false ) : mixed | Get an argument. | |
get_brick_layouted_html ( $html ) : string | ||
get_brick_layouts ( ) : array | Returns the brick layouts set for the brick. These are the values previously passed to set_brick_layouts and/or add_brick_layout. | |
get_data ( ) : array | boolean | ||
get_data_group ( $group_name, boolean $default_value = false, boolean $prepend_this_name = true ) : boolean | mixed | Use this to get an entire group of data. | |
get_data_item ( $item_name, boolean $prepend_this_name = true, boolean $group_name = false, boolean $default_value = false ) : boolean | mixed | Get the value of a data item | |
get_html ( array $args = [], mixed $brick_layouts = false ) : string | ||
get_inline_css ( boolean $group_name = false ) : boolean | mixed | string | ||
get_is_layout ( ) : boolean | ||
get_is_option ( ) : boolean | ||
get_is_sub_field ( ) : boolean | ||
get_key ( ) : string | ||
get_name ( ) : string | ||
get_post_id_to_get_field_from ( ) : boolean | ||
get_setting ( string $name, string $default_value = '' ) : string | This function makes sure that we have means to get essential settings in the same way as for fields etc. | |
get_settings ( fewbricks\acf\field-group | |
Get settings of a field. | |
has_brick_layout ( $brick_layout_name ) : boolean | Checks if the brick has a layout with the name that you pass to the function. Returns true if it does, false if not. | |
set_arg ( $name, $value ) | Set an argument. | |
set_brick_layouts ( string | array $brick_layouts ) | Set brick layouts. | |
set_data ( array $data ) : |
||
set_data_item ( $item_name, $value, boolean $prepend_this_name = true, boolean $group_name = false ) | Use this to set custom data for the brick. | |
set_field_label_prefix ( $prefix ) | ||
set_field_label_suffix ( $suffix ) | ||
set_inline_css ( $attribute, $value, boolean $group_name = false ) | ||
set_is_layout ( $is_layout ) | ||
set_is_option ( $is_option ) | ||
set_is_sub_brick ( $is_sub_brick ) | ||
set_is_sub_field ( $is_sub_field ) | ||
set_key ( $key ) | ||
set_label ( $label ) | ||
set_name ( $name ) | ||
set_post_id_to_get_field_from ( $post_id ) | Set a value that should be passed as the second argument to ACFs get_field. | |
set_setting ( $name, $value ) | This function makes sure that we have means to get essential settings in the same way as for fields etc. |
Method | Description | |
---|---|---|
add_brick ( |
Add a sub brick to the brick. | |
add_common_field ( string $common_field_array_key, string $key, array $settings = [] ) | Add a common field to the brick. | |
add_field ( |
Add a field to the brick. | |
add_flexible_content ( |
Add a flexible content to the brick. | |
add_repeater ( |
Add a repeater to the brick. | |
create_sub_brick_object ( $sub_brick_name, $name_setting ) : mixed | ||
get_brick_template_html ( boolean | string $template_base_path = false ) : string | Executes a template file for the current class and returns the output. | |
get_child_brick ( string $brick_class_name, $name, boolean $is_layout = false, boolean $is_sub_field = false ) : mixed | Returns an instance of a class with the name of $brick_class_name as an ACF layout in flexible content. | |
get_child_brick_in_repeater ( $repeater_name, $brick_name, $brick_class_name ) : mixed | ||
get_data_name ( $data_name ) : string | ||
get_field ( $data_name, boolean $post_id = false, boolean $prepend_this_name = true, boolean $get_from_sub_field = false ) : boolean | mixed | null | void | ||
get_field_in_repeater ( string $repeater_name, $data_name, boolean $post_id = false ) : boolean | mixed | null | void | ||
have_rows ( $name ) : boolean | Wrapper function for ACFs have_rows() | |
the_row ( ) | Wrapper function for ACFs the_row to avoid confusion on when to use $this or not for ACF functions. |
Method | Description | |
---|---|---|
prepare_label ( $object_to_prepare_for ) | ||
prepare_label_addition ( |
||
prepare_name ( |
||
prepare_settings ( $object_to_prepare_for ) | Prepare settings of the brick. | |
remove_fields ( ) |
public __construct ( string $name, string $key = '' ) | ||
$name | string | Name to use when fetching data for the brick |
$key | string | This value must be unique system wide. See the readme-file for tips on how to achieve this. Note that it only needs to be set when registering the brick to a field group, layout etc. No need to pass it when called from the frontend to print the brick. |
protected add_brick ( |
||
$brick_to_add |
public add_brick_layout ( string $brick_layout ) | ||
$brick_layout | string |
protected 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 | Any extra settings to set on the field. Can be used to override existing settings as well. |
public add_css_class ( $class_name ) | ||
$class_name |
protected add_flexible_content ( |
||
$flexible_content |
protected add_repeater ( |
||
$repeater |
protected create_sub_brick_object ( $sub_brick_name, $name_setting ) : mixed | ||
$sub_brick_name | ||
$name_setting | ||
return | mixed |
public get_brick_layouted_html ( $html ) : string | ||
$html | ||
return | string |
public get_brick_layouts ( ) : array | ||
return | array |
protected get_child_brick_in_repeater ( $repeater_name, $brick_name, $brick_class_name ) : mixed | ||
$repeater_name | ||
$brick_name | ||
$brick_class_name | ||
return | mixed |
public get_data_group ( $group_name, boolean $default_value = false, boolean $prepend_this_name = true ) : boolean | mixed | ||
$group_name | string The name of the group. | |
$default_value | boolean | If the group could not be found, this value will be returned. |
$prepend_this_name | boolean | If the name of the brick should be prepended on the group name. |
return | boolean | mixed |
public get_data_item ( $item_name, boolean $prepend_this_name = true, boolean $group_name = false, boolean $default_value = false ) : boolean | mixed | ||
$item_name | string The name of the item that we want to get. | |
$prepend_this_name | boolean | If the name of the brick should be prepended on the item name. See set_data_item for more info on this. |
$group_name | boolean | The name of the group that the data is in. |
$default_value | boolean | If the data item does not exist, this is what will be returned. |
return | boolean | mixed |
protected get_data_name ( $data_name ) : string | ||
$data_name | ||
return | string |
public get_html ( array $args = [], mixed $brick_layouts = false ) : string | ||
$args | array | Any arguments that you need to pass to the brick on runtime. Available as $this->get_html_args |
$brick_layouts | mixed | Array or string with the file name(s) (without .php) of any layouts that you want to wrap the brick in. Layout files must be placed in [theme]/fewbricks/brick-layouts/. |
return | string |
public get_post_id_to_get_field_from ( ) : boolean | ||
return | boolean |
public get_settings ( fewbricks\acf\field-group | |
||
$object_to_get_for | fewbricks\acf\field-group | |
|
return | array |
public has_brick_layout ( $brick_layout_name ) : boolean | ||
$brick_layout_name | ||
return | boolean | True if the brick has a layout with the passed name, false if not. |
public set_brick_layouts ( string | array $brick_layouts ) | ||
$brick_layouts | string | array | Array or string with the name of the layout(s) (without .php). Layout files must be placed in [theme]/fewbricks/brick-layouts/. |
public set_data_item ( $item_name, $value, boolean $prepend_this_name = true, boolean $group_name = false ) | ||
$item_name | string The name of the item. | |
$value | mixed The value of the item. | |
$prepend_this_name | boolean | If the item name should be prepended with the name of the brick. This is an unfortunate left over from an early version. But it would cause a lot of trouble to remove it now so we leave it be. |
$group_name | boolean | Use this if you want to create groups of data. |
public set_inline_css ( $attribute, $value, boolean $group_name = false ) | ||
$attribute | ||
$value | ||
$group_name | boolean |
public set_post_id_to_get_field_from ( $post_id ) | ||
$post_id |
public set_setting ( $name, $value ) | ||
$name | ||
$value |
protected the_row ( ) |
protected $get_html_args |
protected $is_layout |
protected $is_option |
protected $is_sub_brick |
protected $is_sub_field |