Skip to content

Commit

Permalink
Deprecated field and option helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkla committed May 23, 2021
1 parent 83a32b9 commit 70afa45
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 24 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# CHANGELOG

## 11.0.1

- Deprecated `field` and `option` helper functions

## 11.0.0

- Added `readonly` and `disabled` to date fields
- Rename `Radio` class to `RadioButton`
- Rename `Wysiwyg` class to `WysiwygEditor`
- Renamed `Radio` class to `RadioButton`
- Renamed `Wysiwyg` class to `WysiwygEditor`
- Updated field label to name conversion from `kebab-case` to `snake_case`

## 10.0.0
Expand Down
21 changes: 0 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Extended ACF provides an object oriented API to register groups and fields with
- [Fields](#fields)
- [Location](#location)
- [Conditional Logic](#conditional-logic)
- [Theming](#theming)
- [Custom Configuration](#custom-configuration)
- [Custom Fields](#custom-fields)

Expand Down Expand Up @@ -637,26 +636,6 @@ Url::make('Link', 'url')
]),
```

## Theming

This package provides two helper functions to make theming with custom fields much cleaner.

### Field

Instead of fetching data with `get_field` and `get_sub_field` you can use the `field` helper function. It checks if field exist as a sub field and then as a "normal" field. Note that this will not work if nested fields in the same field group share the same name.

```php
echo field('title');
```

### Option

Instead of passing the `option` key to the `get_field` function, you may use the `option` function. It will automagically use the `get_field` function with the `option` key.

```php
echo option('github-url');
```

## Custom Configuration

If your application use third-party plugins which extend the default fields, you can extend the field classes in this package. Lets say you've want to add a configuration key to the select field. Create a new class which extends the base `WordPlate\Acf\Fields\Select` class:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "11.0-dev"
"dev-master": "11.1-dev"
}
},
"autoload": {
Expand Down
4 changes: 4 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* @param int|\WP_Post|null $post
*
* @return mixed
*
* @deprecated Will be removed in a future WordPlate version.
*/
function field(string $name, $post = null)
{
Expand All @@ -45,6 +47,8 @@ function field(string $name, $post = null)
* @param string $name
*
* @return mixed
*
* @deprecated Will be removed in a future WordPlate version.
*/
function option(string $name)
{
Expand Down

0 comments on commit 70afa45

Please sign in to comment.