supported field types are listed here
* @a-order 2
*/
public string $key;
/**
* @label Label
* @instructions If filled will be added to the markup as a prefix label of the field above
* @a-order 2
*/
public string $label;
/**
* @label Link Label
* @instructions You can set the link label here. Leave empty to use the default
* @a-order 2
*/
public string $linkLabel;
/**
* @label Image Size
* @instructions Controls the size of the image, it changes the image src
* @a-type select
* @default_value full
* @a-order 2
*/
public string $imageSize;
/**
* @a-type post_object
* @post_type ["acf_views"]
* @return_format id
* @allow_null 1
* @label ACF View
* @instructions If filled then Posts within this field will be displayed using the selected View. Read more
* @a-order 2
* @a-pro The field must be not required or have default value!
*/
public int $acfViewId;
/**
* @a-type select
* @label Gallery Layout
* @instructions Select the gallery layout type. If Masonry is chosen see 'Field Options' for more settings. Read more
* @choices {"plain":"Default","masonry": "Masonry"}
* @default_value plain
* @a-order 2
* @a-pro The field must be not required or have default value!
*/
public string $galleryType;
/**
* @label Image Lightbox
* @instructions If enabled images will include a zoom icon on hover and when clicked popup with a large image
* @a-order 2
* @a-pro The field must be not required or have default value!
*/
public bool $galleryWithLightBox;
/**
* @a-type tab
* @label Field Options
* @a-order 4
*/
public bool $advancedTab;
/**
* @label Identifier
* @instructions Used in the markup, leave empty to use chosen field name. Allowed symbols : letters, numbers, underline and dash. Important! Should be unique within the group
* @a-order 6
*/
public string $id;
/**
* @label Default Value
* @instructions Set up default value, only used when the field is empty
* @a-order 6
*/
public string $defaultValue;
/**
* @label Show When Empty
* @instructions By default, empty fields are hidden. Turn on to show even when field has no value
* @a-order 6
*/
public bool $isVisibleWhenEmpty;
/**
* @label Masonry: Row Min Height
* @instructions Minimum height of a row in px
* @default_value 180
* @a-order 6
* @a-pro The field must be not required or have default value!
*/
public int $masonryRowMinHeight;
/**
* @label Masonry: Gutter
* @instructions Margin between items in px
* @default_value 20
* @a-order 6
* @a-pro The field must be not required or have default value!
*/
public int $masonryGutter;
/**
* @label Masonry: Mobile Gutter
* @instructions Margin between items on mobile in px
* @default_value 10
* @a-order 6
* @a-pro The field must be not required or have default value!
*/
public int $masonryMobileGutter;
/**
* @label Hide Google Map
* @instructions The Map is shown by default. Turn this on to hide the map
* @a-order 6
* @a-pro The field must be not required or have default value!
*/
public bool $isMapWithoutGoogleMap;
/**
* @label Map address format
* @instructions Use these variables to format your map address:
$street_number$, $street_name$, $city$, $state$, $post_code$, $country$
HTML is also supported. If left empty the address is not shown.
* @a-order 6
* @a-pro The field must be not required or have default value!
*/
public string $mapAddressFormat;
/**
* @label Values delimiter
* @instructions If multiple values are chosen, you can define their delimiter here. HTML is supported
* @a-order 6
*/
public string $optionsDelimiter;
public static function getAcfFieldIdByKey(string $key): string
{
$fieldId = explode('|', $key);
// group, field, [subField]
return 3 === count($fieldId) ?
$fieldId[2] :
($fieldId[1] ?? '');
}
public static function createKey(string $group, string $field, string $subField = ''): string
{
$fullFieldId = $group . '|' . $field;
$fullFieldId .= $subField ?
'|' . $subField :
'';
return $fullFieldId;
}
public function getAcfFieldId(): string
{
return self::getAcfFieldIdByKey($this->key);
}
}