<commit_before># ACF

![acf](https://user-images.githubusercontent.com/499192/34915298-1782a500-f924-11e7-85a7-dc7de6aacc14.png)

> An [Advanced Custom Fields](https://www.advancedcustomfields.com) helper for [WordPlate](https://wordplate.github.io).

If you're working with multiple developers on a WordPress application with custom fields it can be hard to keep track of changes made in custom fields. This package will help you register advanced custom fields with PHP without caring about field keys. All fields will have their own helper functions that automagically creates unique field keys based on their parent field group. All fields exists within the theme and can be added to version control.

[![Build Status](https://img.shields.io/travis/wordplate/acf/master.svg?style=flat)](https://travis-ci.org/wordplate/acf)
[![StyleCI](https://styleci.io/repos/87427318/shield?style=flat)](https://styleci.io/repos/87427318)
[![Coverage Status](https://img.shields.io/codecov/c/github/wordplate/acf.svg?style=flat)](https://codecov.io/github/wordplate/acf)
[![Latest Version](https://img.shields.io/github/release/wordplate/acf.svg?style=flat)](https://github.com/wordplate/acf/releases)
[![License](https://img.shields.io/packagist/l/wordplate/acf.svg?style=flat)](https://packagist.org/packages/wordplate/acf)

## Installation

Require this package, with [Composer](https://getcomposer.org/), in the root directory of your project.

```bash
$ composer require wordplate/acf
```

## Usage

Use the `acf_field_group()` helper function to register a new field group in ACF. It uses the [`acf_add_local_field_group()`](https://www.advancedcustomfields.com/resources/register-fields-via-php#example) function behind the scenes. The difference is that it appends the `key` value to all fields. Below you'll find an example of a field group.

```php
$fields = [
    acf_image(['name' => 'image', 'label' => 'Image']),
    acf_text(['name' => 'title', 'label' => 'Title']),
];

$location = [
    [
        acf_location('post_type', 'page')
    ],
];

acf_field_group([
    'title' => 'About',
    'fields' => $fields,
    'style' => 'seamless',
    'location' => $location,
]);
```

[Visit the official documentation to read more about the field group settings.](https://www.advancedcustomfields.com/resources/register-fields-via-php#group-settings)

## Fields

All fields accepts an array of settings. All field settings arrays must have the keys `label` and `name`. Below the example you'll find a list of available field functions.

```php
acf_text([
    'label' => 'Field Label'
    'name' => 'unique-field-name'
]);
```

### Settings

Below you'll find a list of settings and their descriptions you can add to your fields. [Visit the official documentation](https://www.advancedcustomfields.com/resources/register-fields-via-php#field-settings) to read more about the field settings. Please **note** that the `type` and `key` values will be automagically added by this package. Please don't add these values manually, they will be overwritten.

Name | Description
---- | -----------
`label` | This is the label which appears on the edit page when entering a value.
`name` | This is the name used to save and load data from the database. This name must be a single word, no spaces, underscores and dashes allowed.
`instructions` | This text appears on the edit page when entering a value.
`required` | Required fields will cause validation to run when saving a post. When attempting to save an empty value to a required field, an error message will display.
`conditional_logic` | Once enabled, more settings will appear to customize the logic which determines if the current field should be visible or not. Groups of conditional logic can be created to allow for multiple and/or statements. The available [toggle](#choice-fields) fields are limited to those which are of the type select, checkbox, true/false, radio.
`wrapper` | An array of attributes given to the field element such as `width`, `class` and `id`.
`default_value` | A default value used by ACF if no value has yet been saved.
`placeholder` | The placeholder appears within input when no value exists.
`prepend` | The prepend value adds a visual text element before the input.
`append` | The append value adds a visual text element before the input.

### Basic Fields

- `acf_email()` - The [email field](https://www.advancedcustomfields.com/resources/text) creates a simple email input.
    
    ```php
    acf_email([
        'name' => 'email',
        'label' => 'Email',
        'instructions' => 'Add the email address.',
        'required' => true,
    ]);
    ```
<commit_msg>Add details test<commit_after># ACF

![acf](https://user-images.githubusercontent.com/499192/34915298-1782a500-f924-11e7-85a7-dc7de6aacc14.png)

> An [Advanced Custom Fields](https://www.advancedcustomfields.com) helper for [WordPlate](https://wordplate.github.io).

If you're working with multiple developers on a WordPress application with custom fields it can be hard to keep track of changes made in custom fields. This package will help you register advanced custom fields with PHP without caring about field keys. All fields will have their own helper functions that automagically creates unique field keys based on their parent field group. All fields exists within the theme and can be added to version control.

[![Build Status](https://img.shields.io/travis/wordplate/acf/master.svg?style=flat)](https://travis-ci.org/wordplate/acf)
[![StyleCI](https://styleci.io/repos/87427318/shield?style=flat)](https://styleci.io/repos/87427318)
[![Coverage Status](https://img.shields.io/codecov/c/github/wordplate/acf.svg?style=flat)](https://codecov.io/github/wordplate/acf)
[![Latest Version](https://img.shields.io/github/release/wordplate/acf.svg?style=flat)](https://github.com/wordplate/acf/releases)
[![License](https://img.shields.io/packagist/l/wordplate/acf.svg?style=flat)](https://packagist.org/packages/wordplate/acf)

## Installation

Require this package, with [Composer](https://getcomposer.org/), in the root directory of your project.

```bash
$ composer require wordplate/acf
```

## Usage

Use the `acf_field_group()` helper function to register a new field group in ACF. It uses the [`acf_add_local_field_group()`](https://www.advancedcustomfields.com/resources/register-fields-via-php#example) function behind the scenes. The difference is that it appends the `key` value to all fields. Below you'll find an example of a field group.

```php
$fields = [
    acf_image(['name' => 'image', 'label' => 'Image']),
    acf_text(['name' => 'title', 'label' => 'Title']),
];

$location = [
    [
        acf_location('post_type', 'page')
    ],
];

acf_field_group([
    'title' => 'About',
    'fields' => $fields,
    'style' => 'seamless',
    'location' => $location,
]);
```

[Visit the official documentation to read more about the field group settings.](https://www.advancedcustomfields.com/resources/register-fields-via-php#group-settings)

## Fields

All fields accepts an array of settings. All field settings arrays must have the keys `label` and `name`. Below the example you'll find a list of available field functions.

```php
acf_text([
    'label' => 'Field Label'
    'name' => 'unique-field-name'
]);
```

### Settings

Below you'll find a list of settings and their descriptions you can add to your fields. [Visit the official documentation](https://www.advancedcustomfields.com/resources/register-fields-via-php#field-settings) to read more about the field settings. Please **note** that the `type` and `key` values will be automagically added by this package. Please don't add these values manually, they will be overwritten.

Name | Description
---- | -----------
`label` | This is the label which appears on the edit page when entering a value.
`name` | This is the name used to save and load data from the database. This name must be a single word, no spaces, underscores and dashes allowed.
`instructions` | This text appears on the edit page when entering a value.
`required` | Required fields will cause validation to run when saving a post. When attempting to save an empty value to a required field, an error message will display.
`conditional_logic` | Once enabled, more settings will appear to customize the logic which determines if the current field should be visible or not. Groups of conditional logic can be created to allow for multiple and/or statements. The available [toggle](#choice-fields) fields are limited to those which are of the type select, checkbox, true/false, radio.
`wrapper` | An array of attributes given to the field element such as `width`, `class` and `id`.
`default_value` | A default value used by ACF if no value has yet been saved.
`placeholder` | The placeholder appears within input when no value exists.
`prepend` | The prepend value adds a visual text element before the input.
`append` | The append value adds a visual text element before the input.

### Basic Fields

<details>
    <summary>`acf_email()` - The [email field](https://www.advancedcustomfields.com/resources/text) creates a simple email input.</summary>
    
    ```php
    acf_email([
        'name' => 'email',
        'label' => 'Email',
        'instructions' => 'Add the email address.',
        'required' => true,
    ]);
    ```
</details>


{'fraction_non_alphanumeric': 0.12080034239246737, 'fraction_numerical': 0.010699764605178685, 'mean_word_length': 4.378020713463751, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 37, 'https://': 36, 'lorem ipsum': 0, 'www.': 10, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '276145', 'n_tokens_mistral': 2797, 'n_tokens_neox': 2618, 'n_words': 1006}