Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/FieldBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* @method FieldBuilder addImage(string $name, array $args = [])
* @method FieldBuilder addFile(string $name, array $args = [])
* @method FieldBuilder addGallery(string $name, array $args = [])
* @method FieldBuilder addIconPicker(string $name, array $args = [])
* @method FieldBuilder addSeparator(string $name, array $args = [])
* @method FieldBuilder addTrueFalse(string $name, array $args = [])
* @method FieldBuilder addSelect(string $name, array $args = [])
* @method FieldBuilder addRadio(string $name, array $args = [])
Expand Down
68 changes: 68 additions & 0 deletions src/FieldsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,74 @@ public function addGallery($name, array $args = [])
return $this->addField($name, 'gallery', $args);
}

/**
* Add an icon picker field.
*
* @param string $name
* @param array $args {
* Field configuration options.
*
* @type string $label Field label.
* @type string $instructions Helper text shown below the field.
* @type bool|int $required Whether the field is required.
* @type string|array $default_value Default selected icon value. When using the `array` return format, this is typically an array with `type` and `value` keys.
* @type array $tabs Tabs enabled for icon selection. Supported values are `dashicons`, `media_library`, and `url`.
* @type string $return_format Return format for the saved value. Either `string` or `array`.
* @type array $wrapper Wrapper attributes.
* }
* @throws FieldNameCollisionException If name already exists.
* @return FieldBuilder
* @example
*
* ```php
* $fields->addIconPicker('social_icon', [
* 'default_value' => [
* 'type' => 'dashicons',
* 'value' => 'dashicons-admin-site',
* ],
* 'tabs' => ['dashicons', 'url'],
* 'return_format' => 'string',
* ]);
* ```
* @api
*/
public function addIconPicker($name, array $args = [])
{
return $this->addField($name, 'icon_picker', $args);
}

/**
* Add a separator field.
*
* This field is a layout-only divider in ACF and does not render a value.
* It does not expose custom field settings beyond the standard base field
* options supported by ACF.
*
* @param string $name
* @param array $args {
* Field configuration options.
*
* @type string $label Optional label shown in the field editor.
* @type string $instructions Optional helper text.
* @type bool|int $required Supported by the base field API, but ignored by the separator field.
* @type array $wrapper Wrapper attributes.
* }
* @throws FieldNameCollisionException If name already exists.
* @return FieldBuilder
* @example
*
* ```php
* $fields->addSeparator('content_break', [
* 'label' => 'Content Settings',
* ]);
* ```
* @api
*/
public function addSeparator($name, array $args = [])
{
return $this->addField($name, 'separator', $args);
}

/**
* @param string $name
* @param array $args field configuration
Expand Down
Loading