Read more * @a-order 2 * @a-pro The field must be not required or have default value! */ public string $acfViewId; /** * @a-type select * @label Gallery layout * @instructions Select the gallery layout type. Customize the layout after saving, by editing the JS Code in the CSS & JS tab * @choices {"plain":"None","macy_v2":"Classic Masonry (macy v2, 10.6KB js)", "masonry":"Flat Masonry (acf-views, 4.9KB js)", "lightgallery_v2":"Inline-Gallery (lightgallery v2, 47.1KB js, 9.2KB css)"} * @default_value plain * @a-order 2 * @a-pro The field must be not required or have default value! */ public string $galleryType; /** * @a-type select * @label Enable Lightbox * @instructions Select the lightbox library to enable. Customize the lightbox after saving, by editing the JS Code in the CSS & JS tab * @choices {"none":"None","lightgallery_v2":"LightGallery v2 (47.1KB js, 9.2KB css)", "simple":"Simple (no settings, 5.2KB js)"} * @default_value none * @a-order 2 * @a-pro The field must be not required or have default value! */ public string $lightboxType; /** * @a-type select * @label Enable Slider * @instructions Select the slider library to enable.
Customize the slider after saving, by editing the JS Code in the CSS & JS tab * @choices {"none":"None","splide_v4":"Splide v4 (29.8KB js, 5KB css)"} * @default_value none * @a-order 2 * @a-pro The field must be not required or have default value! */ public string $sliderType; /** * @a-type tab * @label Field Options * @a-order 4 */ public bool $advancedTab; /** * @label Identifier * @instructions Used in the markup.
Allowed symbols : letters, numbers, underline and dash.
Important! Should be unique within the View * @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 Open link in a new tab * @instructions By default, this setting is inherited from ACF, if available. Turn it on to always open in a new tab * @a-order 6 */ public bool $isLinkTargetBlank; /** * @label Map Marker Icon * @instructions Customize the Map Marker by using your own icon or uploading an image from Flaticon (.png, .jpg allowed).
Dimensions of 32x32px is recommended * @a-type image * @return_format id * @a-order 6 * @a-pro The field must be not required or have default value! */ public int $mapMarkerIcon; /** * @label Map Marker icon title * @instructions Shown when mouse hovers on Map Marker * @a-order 6 * @a-pro The field must be not required or have default value! */ public string $mapMarkerIconTitle; /** * @label Hide 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 Show address from the map * @instructions The address is hidden by default. Turn this on to show the address from the map * @a-order 6 * @a-pro The field must be not required or have default value! */ public bool $isMapWithAddress; /** * @label Values delimiter * @instructions If multiple values are chosen, you can define their delimiter here. HTML is supported * @a-order 6 */ public string $optionsDelimiter; // DO NOT USE THESE FIELDS, THEY'RE DEPRECATED! /** * @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! * @a-deprecated DO NOT USE THIS FIELD, IT'S DEPRECATED! */ public string $mapAddressFormat; /** * @label Masonry: Row Min Height * @instructions Minimum height of a row in px * @a-order 6 * @a-pro The field must be not required or have default value! * @a-deprecated DO NOT USE THIS FIELD, IT'S DEPRECATED! */ public int $masonryRowMinHeight; /** * @label Masonry: Gutter * @instructions Margin between items in px * @a-order 6 * @a-pro The field must be not required or have default value! * @a-deprecated DO NOT USE THIS FIELD, IT'S DEPRECATED! */ public int $masonryGutter; /** * @label Masonry: Mobile Gutter * @instructions Margin between items on mobile in px * @a-order 6 * @a-pro The field must be not required or have default value! * @a-deprecated DO NOT USE THIS FIELD, IT'S DEPRECATED! */ public int $masonryMobileGutter; /** * @label With Lightbox * @instructions If enabled, image(s) will include a zoom icon on hover, and when clicked, a popup with a larger image will appear * @a-order 2 * @a-pro The field must be not required or have default value! * @a-deprecated DO NOT USE THIS FIELD, IT'S DEPRECATED! */ public bool $galleryWithLightBox; // cache private string $labelTranslation; private string $linkLabelTranslation; private ?FieldMetaInterface $fieldMeta; public function __construct(CreatorInterface $creator) { parent::__construct($creator); $this->labelTranslation = ''; $this->linkLabelTranslation = ''; $this->fieldMeta = null; } public static function setDataVendors(DataVendors $dataVendors): void { self::$dataVendors = $dataVendors; } public static function getFieldIdByKey(string $key): string { $fieldId = explode('|', $key); // [source:] group | field | [subField] return 3 === count($fieldId) ? $fieldId[2] : ($fieldId[1] ?? ''); } public static function getVendorNameByKey(string $key): string { // for ACF and custom fields source isn't set if (false !== strpos($key, ':')) { return explode(':', $key)[0]; } // back compatibility $fieldId = self::getFieldIdByKey($key); if (0 !== strpos($fieldId, '_')) { return AcfDataVendor::NAME; } return 0 === strpos($fieldId, WooFields::PREFIX) ? WooDataVendor::NAME : WpDataVendor::NAME; } public static function createFieldKey( string $group, string $field, string $subField = '', string $source = '' ): string { $fullFieldId = '' !== $source ? $source . ':' : ''; $fullFieldId .= $group . '|' . $field; $fullFieldId .= '' !== $subField ? '|' . $subField : ''; return $fullFieldId; } public function getVendorName(): string { return self::getVendorNameByKey($this->key); } public function getFieldId(): string { return self::getFieldIdByKey($this->key); } public function getFieldMeta(): FieldMetaInterface { if (null === $this->fieldMeta) { if (null !== self::$dataVendors) { $this->fieldMeta = self::$dataVendors->getFieldMeta($this->getVendorName(), $this->getFieldId()); } else { // dataVendors isn't available. So even we know source and fieldId, do not put them // to make possible debugging easier $this->fieldMeta = new FieldMeta('unset-data-vendors', ''); } } return $this->fieldMeta; } // for RepeaterField.php and tests only! public function _setFieldMeta(FieldMetaInterface $fieldMeta): void { $this->fieldMeta = $fieldMeta; } public function getTwigFieldId(): string { return str_replace('-', '_', $this->id); } public function getLabelTranslation(): string { if ('' !== $this->label && '' === $this->labelTranslation) { $this->labelTranslation = Plugin::getLabelTranslation($this->label); } return $this->labelTranslation; } public function getLinkLabelTranslation(): string { if ('' !== $this->linkLabel && '' === $this->linkLabelTranslation) { $this->linkLabelTranslation = Plugin::getLabelTranslation($this->linkLabel); } return $this->linkLabelTranslation; } public function getShortUniqueAcfViewId(): string { return str_replace(ViewData::UNIQUE_ID_PREFIX, '', $this->acfViewId); } }