Cybo Advanced Field EngineCyboweb Technologies · Documentation · v1.0.2

Clone field

Purpose

Reuse fields you already defined. Build a "Button" group once (label, link, style) and add it as Hero button and Footer button to other groups, without copying the fields.

A Clone is linked, not copied: it shows the current fields of its sources. Add a field to the "Button" group and every clone of it gets that field too.

Field type name

clone

Settings

Setting Description
Instructions Help text for editors, shown with the field.
Fields to Reuse Field group keys (the whole group, in order) and/or field keys. Required (cafe_missing_setting). Keys match [a-z0-9_]{1,64}.
Display group: in a box under this field's label. seamless: the fields sit in the form as if they were fields of this group (the value is still grouped under the clone's name).
Layout How the fields are arranged in the box: block, table or row.
Translation Like a Collection: the row is translated, copied or hidden per language. See WPML.
Width Width on edit screens: 100, 75, 66, 50, 33 or 25 (%).
Label per language The label and instructions per language code. See WPML.

PHP return value

An array of the cloned fields' values by field name, or null when nothing is saved:

$button = cafe_get_field( 'hero_button' );
// [ 'label' => 'Start now', 'url' => 'https://example.com/start' ]

Write it the same way; missing sub-fields keep their saved value, null removes the clone's row and all its values:

cafe_update_field( 'hero_button', [ 'label' => 'Go' ] );
cafe_update_field( 'hero_button', null );

Example

  1. Create a group "Button" with Label (Text) and URL (URL). Give it no location rules if it only exists to be reused.
  2. In the "Home page" group add a Clone Hero button, Fields to Reuse: Whole group: Button.
$button = cafe_get_field( 'hero_button' );

if ( $button ) {
	printf( '<a class="button" href="%s">%s</a>', esc_url( $button['url'] ), esc_html( $button['label'] ) );
}