### Install Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md This snippet shows the Composer command to install the Extended ACF package into your project. Ensure you have Composer installed and configured for your PHP project. ```bash composer require vinkla/extended-acf ``` -------------------------------- ### Extended ACF Repeater Field Setup Source: https://github.com/vinkla/extended-acf/blob/master/README.md Illustrates how to configure the Repeater field in Extended ACF, allowing users to add multiple instances of a set of sub-fields. This example sets up an 'Employees' repeater with 'Name' and 'Profile Picture' fields. ```php use Extended\ACF\Fields\Image; use Extended\ACF\Fields\Repeater; use Extended\ACF\Fields\Text; Repeater::make('Employees') ->helperText('Add the employees.') ->fields([ Text::make('Name'), Image::make('Profile Picture'), ]) ->minRows(2) ->maxRows(10) ->collapsed('name') ->button('Add employee') ->paginated(10) ->layout('table') // block, row, table ->required() ``` -------------------------------- ### Shell: Install Symfony Var Dumper for ACF Debugging Source: https://github.com/vinkla/extended-acf/blob/master/README.md Provides the Composer command to install the `symfony/var-dumper` package, which is required to use the `dd` and `dump` methods for debugging in Extended ACF. ```sh composer require symfony/var-dumper --dev ``` -------------------------------- ### Extended ACF Location Rule Example Source: https://github.com/vinkla/extended-acf/blob/master/README.md Demonstrates how to use the Location class in Extended ACF to define custom location rules for field groups. This example shows a basic rule using the `where` method to target specific post types. ```php use Extended\ACF\Location; Location::where('post_type', 'post')->and('post_type', '!=', 'post') // available operators: ==, != ``` -------------------------------- ### Create ACF Text Field with Options Source: https://github.com/vinkla/extended-acf/blob/master/README.md This PHP example shows how to create a Text field using Extended ACF. It demonstrates setting the field label, name, adding helper text, and marking the field as required. This illustrates the fluent interface for configuring field properties. ```php use Extended\ACF\Fields\Text; Text::make('Title', 'heading') ->helperText('Add the text value') ->required() ``` -------------------------------- ### Create Custom Select Field with `myNewSetting` Source: https://github.com/vinkla/extended-acf/blob/master/README.md Shows how to create a custom Select field by extending the base `Select` field class. This example adds a custom method `myNewSetting` to manage a specific setting within the field. ```php namespace App\Fields; use Extended\ACF\Fields\Select as Field; class Select extends Field { public function myNewSetting(string $value): static { $this->settings['my-new-setting'] = $value; return $this; } } ``` -------------------------------- ### PHP: Debugging with `dd` and `dump` Methods in ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md Explains how to use the non-standard `dd` and `dump` methods for debugging ACF fields. Requires installation of `symfony/var-dumper`. ```php Text::make('Name') ->dd() ->dump() ``` -------------------------------- ### Extended ACF Clone Field Example Source: https://github.com/vinkla/extended-acf/blob/master/README.md Illustrates the usage of the Clone field in Extended ACF, which allows selecting and displaying pre-existing fields or groups. This example shows how to include a custom email field within a registered field group. ```php // fields/email.php use Extended\ACF\Fields\Email; return Email::make('Email')->required(); // employee.php register_extended_field_group([ 'fields' => [ require __DIR__.'/fields/email.php'; ] ]); ``` -------------------------------- ### Extended ACF Flexible Content Field Source: https://github.com/vinkla/extended-acf/blob/master/README.md Shows how to implement the Flexible Content field in Extended ACF, enabling the creation of dynamic layouts with unlimited, reorderable content blocks. This example defines a 'Blocks' field with a 'Image' layout. ```php use Extended\ACF\Fields\FlexibleContent; use Extended\ACF\Fields\Layout; use Extended\ACF\Fields\Text; FlexibleContent::make('Blocks') ->helperText('Add the page blocks.') ->button('Add Component') ->layouts([ Layout::make('Image') ->layout('block') ->fields([ Text::make('Description') ]) ]) ->minLayouts(1) ->maxLayouts(10) ->required() ``` -------------------------------- ### Extended ACF Group Field Configuration Source: https://github.com/vinkla/extended-acf/blob/master/README.md Provides an example of the Group field in Extended ACF, used for organizing sub-fields into logical groups. This snippet demonstrates creating a 'Hero' group with 'Title' and 'Background Image' fields. ```php use Extended\ACF\Fields\Group; use Extended\ACF\Fields\Image; use Extended\ACF\Fields\Text; Group::make('Hero') ->helperText('Add a hero block with title, content and image to the page.') ->fields([ Text::make('Title'), Image::make('Background Image'), ]) ->layout('row') ->required() ``` -------------------------------- ### Extended ACF Tab Field Configuration Source: https://github.com/vinkla/extended-acf/blob/master/README.md Shows how to use the Tab field in Extended ACF to group fields into tabbed sections. This example demonstrates creating multiple tabs, setting a default selected tab, and using `endpoint` to create new tab groups. ```php use Extended\ACF\Fields\Tab; Tab::make('Tab 1'), Tab::make('Tab 2'), Tab::make('Tab 3') ->placement('top') // top, left ->selected() // specify which tab should be selected by default ->endpoint(), // This will make a break in the tabs and create a new group of tabs ``` -------------------------------- ### Rename weekStartsOn to firstDayOfWeek Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `weekStartsOn` method has been renamed to `firstDayOfWeek`. This change offers more explicit control over setting the starting day of the week for DatePicker fields. ```PHP ```diff -DatePicker::make('Date')->weekStartsOn(1) +DatePicker::make('Date')->firstDayOfWeek(1) // or use `weekStartsOnMonday` or `weekStartsOnSunday` ``` ``` -------------------------------- ### Extended ACF Message Field Usage Source: https://github.com/vinkla/extended-acf/blob/master/README.md Demonstrates the Message field in Extended ACF, which is used to display static text content within the ACF interface. This example shows a simple message field with custom body text. ```php use Extended\ACF\Fields\Message; Message::make('Heading') ->body('George. One point twenty-one gigawatts.') ->escapeHtml(), ``` -------------------------------- ### PHP WYSIWYG Editor Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md Integrates a full WordPress WYSIWYG (What You See Is What You Get) editor. It allows customization of tabs, toolbar buttons, media uploads, and lazy loading, along with helper text and a required flag. ```PHP use Extended\ACF\Fields\WYSIWYGEditor; WYSIWYGEditor::make('Content') ->helperText('Add the text content.') ->tabs('visual') // all, text, visual (default) ->toolbar(['bold', 'italic', 'link']) // aligncenter, alignleft, alignright, blockquote, bold, bullist, charmap, forecolor, formatselect, fullscreen, hr, indent, italic, link, numlist, outdent, pastetext, redo, removeformat, spellchecker, strikethrough, underline, undo, wp_adv, wp_help, wp_more ->disableMediaUpload() ->lazyLoad() ->required() ``` -------------------------------- ### Rename instructions to helperText Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `instructions` method has been renamed to `helperText`. This provides a more descriptive name for the method used to add helper text to fields. ```PHP ```diff -Text::make('Title')->instructions('Add the title text.') +Text::make('Title')->helperText('Add the title text.') ``` ``` -------------------------------- ### Rename enableOpacity to opacity Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `enableOpacity` method has been renamed to `opacity`. This offers a more concise way to enable or disable the opacity control for fields like ColorPicker. ```PHP ```diff -ColorPicker::make('Background')->enableOpacity() +ColorPicker::make('Background')->opacity() ``` ``` -------------------------------- ### Rename insert to prependFiles Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `insert` method has been renamed to `prependFiles`. This change offers a more descriptive name for the action of prepending files in fields like Gallery. ```PHP ```diff -Gallery::make('Downloads')->insert('prepend') +Gallery::make('Downloads')->prependFiles() ``` ``` -------------------------------- ### Split fileSize into minSize and maxSize Methods Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `fileSize` method has been split into `minSize` and `maxSize`. This provides more precise control over the acceptable file size range for fields like Image. ```PHP ```diff -Image::make('Background')->fileSize('400 KB', 5) +Image::make('Background')->minSize('400 KB')->maxSize(5) ``` ``` -------------------------------- ### Split width into minWidth and maxWidth Methods Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `width` method has been split into `minWidth` and `maxWidth`. This enables the definition of minimum and maximum width constraints for fields such as Image. ```PHP ```diff -Image::make('Product Image')->width(100, 1000) +Image::make('Product Image')->minWidth(100)->maxWidth(1000) ``` ``` -------------------------------- ### Rename Instructions trait to HelperText Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `Instructions` trait has been renamed to `HelperText`. This change impacts how helper text settings are imported and used. ```PHP use Extended\ACF\Fields\Settings\HelperText; ``` -------------------------------- ### Rename prepend to prefix Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `prepend` method has been renamed to `prefix`. This change provides a clearer naming convention for adding a prefix to field values, such as currency symbols. ```PHP ```diff -Number::make('Price')->prepend('$') +Number::make('Price')->prefix('$') ``` ``` -------------------------------- ### Rename min/max to minLayouts/maxLayouts on FlexibleContent Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `min` and `max` methods on the `FlexibleContent` field have been renamed to `minLayouts` and `maxLayouts`. This offers clearer naming for defining the number of flexible content layouts. ```PHP ```diff -FlexibleContent::make('Blocks')->min(1)->max(10) +FlexibleContent::make('Blocks')->minLayouts(1)->maxLayouts(10) ``` ``` -------------------------------- ### PHP: Use Markdown in ACF Field Helper Text Source: https://github.com/vinkla/extended-acf/blob/master/README.md Illustrates how to use Markdown formatting within the `helperText` method for ACF text fields to enhance descriptions with bold, italic, code, and links. ```php Text::make('Title') ->helperText('__strong__ **strong** _italic_ *italic* `code` [link](https://example.com)') ``` -------------------------------- ### Overwrite Field Settings with `withSettings` Source: https://github.com/vinkla/extended-acf/blob/master/README.md Demonstrates how to use the `withSettings` method to add custom settings to an ACF field, overriding any existing configurations. This is a convenient way to apply specific parameters without extending field classes. ```php Text::make('Name') ->withSettings(['my-new-setting' => 'value']) ->required() ``` -------------------------------- ### Split height into minHeight and maxHeight Methods Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `height` method has been split into `minHeight` and `maxHeight`. This allows for defining specific minimum and maximum height constraints for fields like Gallery. ```PHP ```diff -Gallery::make('Carousel')->height(100, 1000) +Gallery::make('Carousel')->minHeight(100)->maxHeight(1000) ``` ``` -------------------------------- ### Rename min/max to minFiles/maxFiles on Gallery Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `min` and `max` methods on the `Gallery` field have been renamed to `minFiles` and `maxFiles`. This provides clearer naming for setting the minimum and maximum number of files allowed. ```PHP ```diff -Gallery::make('Files')->min(1)->max(10) +Gallery::make('Files')->minFiles(1)->maxFiles(10) ``` ``` -------------------------------- ### Extended ACF Accordion Field Source: https://github.com/vinkla/extended-acf/blob/master/README.md Demonstrates how to create and configure Accordion fields in Extended ACF. The Accordion field organizes fields into collapsible panels and can be set to open by default or allow multi-expand functionality. ```php use Extended\ACF\Fields\Accordion; Accordion::make('Address') ->open() ->multiExpand(), // Allow accordion to remain open when other accordions are opened. // Any field after this accordion will become a child. Accordion::make('Endpoint') ->endpoint() ->multiExpand(), // This field will not be visible, but will end the accordion above. // Any fields added after this will not be a child to the accordion. ``` -------------------------------- ### PHP Icon Picker Field Source: https://github.com/vinkla/extended-acf/blob/master/README.md Implements an icon picker field using Extended ACF. Enables selection of Dashicons, Media Library images, or URLs. Supports setting helper text, format, and available tabs for selection. ```php use Extended\ACF\Fields\IconPicker; IconPicker::make('Icon') ->helperText('Add the icon.') ->format('string') // array, string (default) ->tabs(['dashicons']) // [dashicons, media_library, url] (default) ->required() ``` -------------------------------- ### Use Custom OpenStreetMap Field Source: https://github.com/vinkla/extended-acf/blob/master/README.md Demonstrates how to import and use the custom `OpenStreetMap` field, setting its properties like latitude, longitude, and zoom level. ```php use App\Fields\OpenStreetMap; OpenStreetMap::make('Map') ->latitude(56.474) ->longitude(11.863) ->zoom(10) ``` -------------------------------- ### Rename delay to lazyLoad Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `delay` method has been renamed to `lazyLoad`. This provides a more intuitive name for implementing lazy loading functionality, particularly for fields like WysiwygEditor. ```PHP ```diff -WysiwygEditor::make('Biography')->delay() +WYSIWYGEditor::make('Biography')->lazyLoad() ``` ``` -------------------------------- ### PHP Image Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md Handles image uploads with specifications for accepted file types, dimensions, size limits, library source, and preview size. Helper text and a required flag are also configurable. ```PHP use Extended\ACF\Fields\Image; Image::make('Background Image') ->helperText('Add an image in at least 12000x100px and only in the formats **jpg**, **jpeg** or **png**.') ->acceptedFileTypes(['jpg', 'jpeg', 'png']) ->minHeight(500) ->maxHeight(1400) ->minWidth(1000) ->maxWidth(2000) ->minSize('400 KB') ->maxSize(5) // MB if entered as int ->library('all') // all, uploadedTo ->format('array') // id, url, array (default) ->previewSize('medium') // thumbnail, medium, large ->required() ``` -------------------------------- ### PHP URL Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md Creates a URL input field, ensuring that the input is a valid URL format. It includes helper text and a required option. ```PHP use Extended\ACF\Fields\URL; URL::make('Website') ->helperText('Add the employees website link.') ->required() ``` -------------------------------- ### Rename WYSIWYGEditor::make() to disableMediaUpload() Source: https://github.com/vinkla/extended-acf/blob/master/README.md The WYSIWYGEditor method `make` has been updated, and `disableMediaUpload` is now used to disable media uploads. ```PHP WYSIWYGEditor::make('Narrative')->disableMediaUpload() ``` -------------------------------- ### Rename stylisedUi to stylized Method on TrueFalse Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `stylisedUi` method on the `TrueFalse` field has been renamed to `stylized`. This update aligns with common spelling and provides a more straightforward way to style the UI. ```PHP ```diff -TrueFalse::make('Disabled')->stylisedUi(onText: 'Yes') +TrueFalse::make('Disabled')->stylized(on: 'Yes') ``` ``` -------------------------------- ### Split stylisedUi into stylized and lazyLoad on Select Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `stylisedUi` method on the `Select` field has been split into two distinct methods: `stylized` and `lazyLoad`. This allows for more granular control over the field's appearance and loading behavior. ```PHP ```diff -Select::make('Friends')->stylisedUi() +Select::make('Friends')->stylized() -Select::make('Friends')->stylisedUi(true) +Select::make('Friends')->lazyLoad() ``` ``` -------------------------------- ### Create Custom OpenStreetMap Field Source: https://github.com/vinkla/extended-acf/blob/master/README.md Illustrates the creation of a custom `OpenStreetMap` field by extending the base `Field` class and incorporating `HelperText` and `Required` traits. It includes methods for setting latitude, longitude, and zoom level. ```php namespace App\Fields; use Extended\ACF\Fields\Field; use Extended\ACF\Fields\Settings\HelperText; use Extended\ACF\Fields\Settings\Required; class OpenStreetMap extends Field { use HelperText; use Required; protected $type = 'open_street_map'; public function latitude(float $latitude): static { $this->settings['latitude'] = $latitude; return $this; } public function longitude(float $longitude): static { $this->settings['longitude'] = $longitude; return $this; } public function zoom(float $zoom): static { $this->settings['zoom'] = $zoom; return $this; } } ``` -------------------------------- ### PHP Gallery Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md Manages a collection of images with options for accepted file types, dimensions, file counts, size limits, library source, and preview size. It also supports helper text and a required flag. ```PHP use Extended\ACF\Fields\Gallery; Gallery::make('Images') ->helperText('Add the gallery images.') ->acceptedFileTypes(['jpg', 'jpeg', 'png']) ->minHeight(500) ->maxHeight(1400) ->minWidth(1000) ->maxWidth(2000) ->minFiles(1) ->maxFiles(6) ->minSize('400 KB') ->maxSize(5) // MB if entered as int ->library('all') // all, uploadedTo ->format('array') // id, url, array (default) ->previewSize('medium') // thumbnail, medium, large ->prependFiles() ->required() ``` -------------------------------- ### Rename buttonLabel to button Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `buttonLabel` method has been renamed to `button`. This provides a shorter and more direct way to set the button text for fields like Repeater. ```PHP ```diff -Repeater::make('Cats')->buttonLabel('Add Cat') +Repeater::make('Cata')->button('Add Cat') ``` ``` -------------------------------- ### PHP: Set ACF Field Wrapper Width using `column` Shorthand Source: https://github.com/vinkla/extended-acf/blob/master/README.md Demonstrates the use of the `column` method as a shorthand for setting the width of an ACF field's wrapper, equivalent to `wrapper(['width' => value])`. ```php Text::make('Text') ->column(50) // shorthand for ->wrapper(['width' => 50]) ``` -------------------------------- ### PHP: Implement Conditional Logic in ACF Fields Source: https://github.com/vinkla/extended-acf/blob/master/README.md Demonstrates how to use the ConditionalLogic class in PHP to create conditional display rules for ACF fields based on the values of other fields. Supports various operators and 'and'/'or' conditions. ```php use Extended\ACF\ConditionalLogic; use Extended\ACF\Fields\File; use Extended\ACF\Fields\Select; use Extended\ACF\Fields\URL; use Extended\ACF\Fields\Textarea; use Extended\ACF\Fields\Text; Select::make('Type') ->choices([ 'document' => 'Document', 'link' => 'Link to resource', 'embed' => 'Embed', ]), File::make('Document', 'file') ->conditionalLogic([ ConditionalLogic::where('type', '==', 'document') // available operators: ==, !=, >, <, ==pattern, ==contains, ==empty, !=empty ]), URL::make('Link', 'url') ->conditionalLogic([ ConditionalLogic::where('type', '==', 'link') ]), // "and" condition Textarea::make('Embed Code') ->conditionalLogic([ ConditionalLogic::where('type', '!=', 'document')->and('type', '!=', 'link') ]), // use multiple conditional logic for "or" condition Text::make('Title') ->conditionalLogic([ ConditionalLogic::where('type', '!=', 'document'), ConditionalLogic::where('type', '!=', 'link') ]), // conditional logic that relies on another field from a different field group Text::make('Sub Title') ->conditionalLogic([ ConditionalLogic::where( group: 'other-group', name: 'enable_highlight', operator: '==', value: 'on', ) ]), ``` -------------------------------- ### Extended ACF True False Field Source: https://github.com/vinkla/extended-acf/blob/master/README.md Creates a True/False field for ACF, allowing users to select between two states, typically represented as 1 or 0. This field includes options for helper text, a default value (true or false), and custom text labels for the 'on' and 'off' states, along with a required setting. ```php use Extended\ACF\Fields\TrueFalse; TrueFalse::make('Social Media', 'display_social_media') ->helperText('Select whether to display social media links or not.') ->default(false) ->stylized(on: 'Yes', off: 'No') // optional on and off text labels ->required() ``` -------------------------------- ### PHP: Define Custom Field Keys in ACF using `key` Source: https://github.com/vinkla/extended-acf/blob/master/README.md Shows how to use the `key` method to assign a custom, alphanumeric key prefixed with `field_` or `layout_` to ACF fields, which can be used in conditional logic. ```php Text::make('Text') ->key('field_123abc') ``` -------------------------------- ### PHP Google Map Field Source: https://github.com/vinkla/extended-acf/blob/master/README.md Implements a Google Map field using Extended ACF. Creates an interactive map with marker placement. Allows configuration of helper text, center coordinates, zoom level, and makes the field required. ```php use Extended\ACF\Fields\GoogleMap; GoogleMap::make('Address', 'address') ->helperText('Add the Google Map address.') ->center(57.456286, 18.377716) ->zoom(14) ->required() ``` -------------------------------- ### PHP Oembed Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md Facilitates embedding external content like videos, images, and tweets using the oEmbed standard. It includes helper text and a required option. ```PHP use Extended\ACF\Fields\Oembed; Oembed::make('Tweet') ->helperText('Add a tweet from Twitter.') ->required() ``` -------------------------------- ### Rename min/max to minInstances/maxInstances on Layout Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `min` and `max` methods on the `Layout` field have been renamed to `minInstances` and `maxInstances`. This provides more specific naming for controlling the number of layout instances. ```PHP ```diff -Layout::make('Testimonials')->min(1)->max(10) +Layout::make('Testimonials')->minInstances(1)->maxInstances(10) ``` ``` -------------------------------- ### Rename allowMultiple to multiple Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `allowMultiple` method has been renamed to `multiple`. This change offers a more concise way to enable multiple selections for fields like Select. ```PHP ```diff -Select::make('Colors')->allowMultiple() +Select::make('Colors')->multiple() ``` ``` -------------------------------- ### Rename allowNull to nullable Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `allowNull` method has been renamed to `nullable`. This provides a clearer indication that the field can accept null values. ```PHP ```diff -Select::make('Features')->allowNull() +Select::make('Features')->nullable() ``` ``` -------------------------------- ### PHP File Upload Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md Allows file uploads with options for accepted file types, library source, size limits, and output format. It also supports helper text and a required flag. ```PHP use Extended\ACF\Fields\File; File::make('Resturant Menu', 'menu') ->helperText('Add the menu **pdf** file.') ->acceptedFileTypes(['pdf']) ->library('all') // all, uploadedTo ->minSize('400 KB') ->maxSize(5) // MB if entered as int ->format('array') // id, url, array (default) ->required() ``` -------------------------------- ### Extended ACF Radio Button Field Source: https://github.com/vinkla/extended-acf/blob/master/README.md Provides a Radio Button field for ACF, presenting users with a list of selectable inputs where only one option can be chosen. Configuration includes helper text, defining available choices, setting a default selection, specifying the output format, and marking the field as required. ```php use Extended\ACF\Fields\RadioButton; RadioButton::make('Color') ->helperText('Select the text color.') ->choices(['Forest Green', 'Sky Blue']) // ['forest_green' => 'Forest Green', 'sky_blue' => 'Sky Blue'] ->default('forest_green') ->format('value') // array, label, value (default) ->required() ``` -------------------------------- ### PHP Email Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md Creates a simple email input field using the Extended ACF library. It allows setting helper text and marking the field as required. ```PHP use Extended\ACF\Fields\Email; Email::make('Email') ->helperText('Add the employees email address.') ->required() ``` -------------------------------- ### Rename Taxonomy methods: addTerm, loadTerms, saveTerms to create, load, save Source: https://github.com/vinkla/extended-acf/blob/master/README.md The Taxonomy methods for managing terms have been renamed. `addTerm` is now `create`, `loadTerms` is `load`, and `saveTerms` is `save`. ```PHP Taxonomy::make('Category')->create()->load()->save() ``` -------------------------------- ### PHP: Use Custom Field Key in ACF Conditional Logic Source: https://github.com/vinkla/extended-acf/blob/master/README.md Illustrates how to reference a custom field key within the `ConditionalLogic::where` method to define conditions based on fields from different groups or with specific keys. ```php ConditionalLogic::where( name: 'color', operator: '==', value: 'red' key: 'field_123abc', ) ``` -------------------------------- ### Rename characterLimit to maxLength Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `characterLimit` method has been renamed to `maxLength`. This change clarifies that the method sets the maximum allowed length for text input. ```PHP ```diff -Textarea::make('Description')->characterLimit(100) +Textarea::make('Description')->maxLength(100) ``` ``` -------------------------------- ### Field name formatting change: kebab-case to snake_case Source: https://github.com/vinkla/extended-acf/blob/master/README.md Field names are now automatically formatted as snake_case instead of kebab-case. This affects how field names are generated and referenced. ```PHP Text::make('Organization Number') // organization_number ``` -------------------------------- ### PHP Time Picker Field Source: https://github.com/vinkla/extended-acf/blob/master/README.md Implements a time picker field using Extended ACF. Creates a jQuery time selection popup. Allows configuration of helper text, display format, value format, and makes the field required. ```php use Extended\ACF\Fields\TimePicker; TimePicker::make('Start Time', 'time') ->helperText('Add the start time.') ->displayFormat('H:i') ->format('H:i') ->required() ``` -------------------------------- ### Register ACF Field Group with Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md This PHP code demonstrates how to register a new ACF field group using the `register_extended_field_group()` function. It includes registering an Image and a Text field, and setting the location to 'post_type' equal to 'page'. This leverages the object-oriented API provided by Extended ACF. ```php use Extended\ACF\Fields\Image; use Extended\ACF\Fields\Text; use Extended\ACF\Location; add_action('acf/init', function() { register_extended_field_group([ 'title' => 'About', 'fields' => [ Image::make('Image'), Text::make('Title'), ], 'location' => [ Location::where('post_type', 'page') ], ]); }); ``` -------------------------------- ### Rename pagination to paginated Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `pagination` method has been renamed to `paginated`. This update is for consistency when defining pagination settings for fields like Repeater. ```PHP ```diff -Repeater::make('Dogs')->pagination(10) +Repeater::make('Dogs')->paginated(10) ``` ``` -------------------------------- ### PHP Color Picker Field Source: https://github.com/vinkla/extended-acf/blob/master/README.md Implements a color picker field using Extended ACF. Allows users to select a color via a JavaScript popup. Supports setting helper text, default color, opacity, and format. ```php use Extended\ACF\Fields\ColorPicker; ColorPicker::make('Text Color') ->helperText('Add the text color.') ->default('#4a9cff') ->opacity() ->format('string') // array, string (default) ->required() ``` -------------------------------- ### Rename WysiwygEditor to WYSIWYGEditor Class Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `WysiwygEditor` class has been renamed to `WYSIWYGEditor`. This update is for consistency with common naming conventions for WYSIWYG editors. ```PHP ```diff -use Extended\ACF\Fields\WysiwygEditor; +use Extended\ACF\Fields\WYSIWYGEditor; -WysiwygEditor::make('Content') +WYSIWYGEditor::make('Content') ``` ``` -------------------------------- ### Remove Message and ReturnFormat traits Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `Message` and `ReturnFormat` traits have been removed from the package. Ensure your code no longer imports or uses these traits. ```PHP use Extended\ACF\Fields\Settings\Message; use Extended\ACF\Fields\Settings\ReturnFormat; ``` -------------------------------- ### PHP Textarea Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md Creates a textarea for multi-line text input, supporting newline character conversion, maximum length, and row count. Helper text and a required flag are also available. ```PHP use Extended\ACF\Fields\Textarea; Textarea::make('Biography') ->helperText('Add the employees biography.') ->newLines('br') // br, wpautop ->maxLength(2000) ->rows(10) ->required() ``` -------------------------------- ### Update Package Name in Composer Source: https://github.com/vinkla/extended-acf/blob/master/README.md Provides a diff showing how to update the package name in `composer.json` from `wordplate/acf` to `vinkla/extended-acf` for versions 12 and lower. ```diff "-\"wordplate/acf\": \"^12.0\", +\"vinkla/extended-acf\": \"^12.0\"" ``` -------------------------------- ### PHP Date Picker Field Source: https://github.com/vinkla/extended-acf/blob/master/README.md Implements a date picker field using Extended ACF. Creates a jQuery date selection popup. Allows configuration of helper text, display format, value format, and default to current date. ```php use Extended\ACF\Fields\DatePicker; DatePicker::make('Birthday') ->helperText('Add the employee\'s birthday.') ->displayFormat('d/m/Y') ->format('d/m/Y') ->defaultNow() // default to current date ->required() ``` -------------------------------- ### Rename returnFormat() to format() for fields Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `returnFormat` method has been renamed to `format` across all fields. This affects how the return format of field values is specified. ```PHP Select::make('Superhero')->format('value') ``` -------------------------------- ### PHP Text Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md Creates a simple text input field with a maximum length constraint. It supports helper text and can be marked as required. ```PHP use Extended\ACF\Fields\Text; Text::make('Name') ->helperText('Add the employees name.') ->maxLength(100) ->required() ``` -------------------------------- ### Rename mimeTypes to acceptedFileTypes Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `mimeTypes` method has been renamed to `acceptedFileTypes`. This change provides a more descriptive name for specifying the allowed MIME types for file uploads. ```PHP ```diff -File::make('Manual')->mimeTypes(['pdf']) +File::make('Manual')->acceptedFileTypes(['pdf']) ``` ``` -------------------------------- ### PHP: Establish Bidirectional Relationships Between ACF Fields Source: https://github.com/vinkla/extended-acf/blob/master/README.md Shows how to create bidirectional relationships between ACF Relationship fields using the `bidirectional` method. Requires setting custom field keys for each related field. ```php use Extended\ACF\Fields\Relationship; // This field is attached to a "Project" post type. Relationship::make('Related Testimonial') ->postTypes(['testimonial']) ->key('field_related_testimonial') ->bidirectional('field_related_project'), // This field is attached to a "Testimonial" post type. Relationship::make('Related Project') ->postTypes(['project']) ->key('field_related_project') ->bidirectional('field_related_testimonial'), ``` -------------------------------- ### Rename append to suffix Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `append` method has been renamed to `suffix`. This offers a more descriptive name for adding a suffix to field values, like currency symbols. ```PHP ```diff -Number::make('Price')->append('€') +Number::make('Price')->suffix('€') ``` ``` -------------------------------- ### Rename defaultValue to default Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `defaultValue` method has been renamed to `default`. This change simplifies the method name for setting default values on fields. ```PHP ```diff -Text::make('Name')->defaultValue('Jeffrey Way') +Text::make('Name')->default('Jeffrey Way') ``` ``` -------------------------------- ### PHP Password Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md Creates a password input field with helper text and a required constraint. This field is designed for secure input. ```PHP use Extended\ACF\Fields\Password; Password::make('Password') ->helperText('Add the employees secret pwned password.') ->required() ``` -------------------------------- ### Update namespace from WordPlate to Extended\ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md The primary namespace for ACF fields has been updated from `WordPlate\Acf` to `Extended\ACF`. All import statements need to be updated accordingly. ```PHP use Extended\ACF\Fields\Text; use Extended\ACF\Fields\Number; ``` -------------------------------- ### Link Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md The Link field allows selection or definition of a link, including URL, title, and target. It can be formatted as an array or object and can be made required. ```php use Extended\ACF\Fields\Link; Link::make('Read More Link') ->format('array') // url, array (default) ->required() ``` -------------------------------- ### PHP Range Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md Provides an interactive range slider for selecting a numerical value. It allows setting minimum, maximum, and step values, along with helper text and a required flag. ```PHP use Extended\ACF\Fields\Range; Range::make('Rate') ->helperText('Add the employees completion rate.') ->min(0) ->max(100) ->step(10) ->required() ``` -------------------------------- ### Rename min/max to minPosts/maxPosts on Relationship Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `min` and `max` methods on the `Relationship` field have been renamed to `minPosts` and `maxPosts`. This clarifies the context for setting the minimum and maximum number of related posts. ```PHP ```diff -Relationship::make('Posts')->min(1)->max(10) +Relationship::make('Posts')->minPosts(1)->maxPosts(10) ``` ``` -------------------------------- ### PHP Date Time Picker Field Source: https://github.com/vinkla/extended-acf/blob/master/README.md Implements a date and time picker field using Extended ACF. Creates a jQuery popup for selecting both date and time. Supports helper text, display/value formats, first day of the week, and defaulting to the current date/time. ```php use Extended\ACF\Fields\DateTimePicker; DateTimePicker::make('Event Date', 'date') ->helperText('Add the event\'s start date and time.') ->displayFormat('d-m-Y H:i') ->format('d-m-Y H:i') ->firstDayOfWeek(1) // Sunday is 0, Monday is 1, or use `weekStartsOnMonday` or `weekStartsOnSunday` ->defaultNow() // default to current date ->required() ``` -------------------------------- ### PHP Number Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md Creates a simple number input field with validation for minimum and maximum values. It also supports helper text and a required flag. ```PHP use Extended\ACF\Fields\Number; Number::make('Age') ->helperText('Add the employees age.') ->min(18) ->max(65) ->required() ``` -------------------------------- ### Replace Location::if() with Location::where() Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `if` method for location queries has been replaced with `where`. This change affects how location rules are defined for field groups. ```PHP Location::where('post_type', 'post') ``` -------------------------------- ### Rename Url to URL Class Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `Url` class has been renamed to `URL`. This change affects how you instantiate and use the URL field type in your ACF configurations. ```PHP ```diff -use Extended\ACF\Fields\Url; +use Extended\ACF\Fields\URL; -Url::make('GitHub URL') +URL::make('GitHub URL') ``` ``` -------------------------------- ### User Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md The User field creates a select field for choosing users from the system. It allows filtering by user roles and can format the output as an array, object, or just the ID. ```php use Extended\ACF\Fields\User; User::make('User') ->roles(['administrator', 'editor']) // administrator, author, contributor, editor, subscriber ->format('array') // id, object, array (default) ``` -------------------------------- ### Rename mediaUpload to disableMediaUpload Method Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `mediaUpload` method has been renamed to `disableMediaUpload`. This change clarifies that the method is used to disable media uploads for fields like WysiwygEditor. ```PHP ```diff -WysiwygEditor::make('Narrative')->mediaUpload(false) ``` ``` -------------------------------- ### Extended ACF Button Group Field Source: https://github.com/vinkla/extended-acf/blob/master/README.md Creates a Button Group field for Advanced Custom Fields. This field displays a list of radio buttons, allowing users to select one option. It supports helper text, choices, a default value, formatting options, and can be marked as required. ```php use Extended\ACF\Fields\ButtonGroup; ButtonGroup::make('Color') ->helperText('Select the box shadow color.') ->choices(['Forest Green', 'Sky Blue']) // ['forest_green' => 'Forest Green', 'sky_blue' => 'Sky Blue'] ->default('forest_green') ->format('value') // array, label, value (default) ->required() ``` -------------------------------- ### Rename min/max to minRows/maxRows on Repeater Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `min` and `max` methods on the `Repeater` field have been renamed to `minRows` and `maxRows`. This provides more specific naming for controlling the number of rows in a repeater. ```PHP ```diff -Repeater::make('Items')->min(1)->max(10) +Repeater::make('Items')->minRows(1)->maxRows(10) ``` ``` -------------------------------- ### Taxonomy Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md The Taxonomy field facilitates the selection of one or more taxonomy terms. It offers various appearance options like checkboxes or select dropdowns and can be configured to allow term creation or loading. ```php use Extended\ACF\Fields\Taxonomy; Taxonomy::make('Cinemas') ->helperText('Select one or more cinema terms.') ->taxonomy('cinema') ->appearance('checkbox') // checkbox, multi_select, radio, select ->create(false) // false or true (default) ->load(true) // true or false (default) ->save(true) // true or false (default)x ->format('id') // object, id (default) ``` -------------------------------- ### Page Link Field - Extended ACF Source: https://github.com/vinkla/extended-acf/blob/master/README.md The Page Link field enables selection of posts, pages, or custom post types. It supports filtering by post type, post status, and taxonomies, and can be configured to allow multiple selections or be nullable. ```php use Extended\ACF\Fields\PageLink; PageLink::make('Contact Link') ->postTypes(['contact']) ->postStatus(['publish']) // draft, future, pending, private, publish ->taxonomies(['category:city']) ->disableArchives() ->nullable() ->multiple() ->required() ``` -------------------------------- ### Rename PageLink::allowArchives() to disableArchives() Source: https://github.com/vinkla/extended-acf/blob/master/README.md The `allowArchives` method on PageLink has been renamed to `disableArchives`. This method is used to control archive settings for page links. ```PHP PageLink::make('Link')->disableArchives() ```