# Layout

Please make sure you've installed the latest version of the plugin before using these filters.

Some filters are common and available in both the Lite and Pro versions, where some are only available in the Pro Edition, these have been labelled as **(Pro)**.

{% hint style="success" %}
Do you need to customize something but a filter or hook is unavailable?&#x20;

Then [Contact us](https://advanced-views.com/support/) and we'll try to add it as soon as possible.
{% endhint %}

## List

[acf\_views/view/field\_data](#field-data)

[acf\_views/view/field\_data/type={fieldType}](#field-data)

[acf\_views/view/field\_data/name={fieldName}](#field-data)

[acf\_views/view/field\_data/view\_id={viewId}](#field-data)

[acf\_views/view/custom\_variables](#custom-view-variables-pro)

[acf\_views/view/custom\_variables/view\_id={viewId}](#custom-layout-variables)

[do\_shortcode\_tag](#shortcode-output)

## Description

### Field Data

Allows you to amend field data before it's inserted into the template.

{% code overflow="wrap" %}

```php
add_filter('acf_views/view/field_data', function ($fieldData, $fieldMeta, $viewId) {
    // any modifications to the $fieldData here
    return $fieldData;
}, 10, 3);
```

{% endcode %}

* `$field_data` (array) Field data
* `$field_meta` (Field\_Meta\_Interface) Information about the field.
* `$view_id` (string) Unique ID of the current *Layout*.

### Custom Layout Variables

Allows to add custom variables to the custom markup.&#x20;

{% code overflow="wrap" %}

```php
add_filter('acf_views/view/custom_variables', function ($phpVariables, $viewId, $objectId, $fieldValues) {
    // any modifications to the $phpVariables here
    return $phpVariables;
}, 10, 4);
```

{% endcode %}

* `$php_variables` (array) Current custom variables (Custom Markup Variables field, an associative array of values, where keys are variable names). These variables can be accessed in the custom markup with brackets, like `{VARIABLE_NAME}`
* `$view_id` (string) Unique ID of the current *Layout*
* `$object_id` (int) ID of the current data post
* `$field_values` (array) An associative field values array, where keys are field identifiers

### Shortcode output

It’s a built-in WordPress hook that allows modifying the output of the whole shortcode. Code example shown below. Read more [here](https://developer.wordpress.org/reference/hooks/do_shortcode_tag/).

```php
add_filter('do_shortcode_tag', function ($output, $tag, $attr) {
    if ('acf_views' != $tag) {
        return $output;
    }

    // todo my custom changes for $output

    return $output;
}, 10, 3);
```

### FieldMeta

Some filters have a plugin's class instances as arguments. These classes implement interfaces, and if you want to declare a type of a filter argument in your code, you must use an interface instead of a class name.&#x20;

```php
namespace Org\Wplake\Advanced_Views\Views;

interface Field_Meta_Interface {
	// getters.
	public function is_field_exist(): bool;

	public function get_field_id(): string;

	public function get_name(): string;

	public function get_type(): string;

	public function get_return_format(): string;

	public function get_display_format(): string;

	/**
	 * @return array<string, string>
	 */
	public function get_choices(): array;

	public function is_multiple(): bool;

	public function is_repeater(): bool;

	public function get_self_repeatable_meta(): ?Field_Meta_Interface;

	/**
	 * @return string|string[]
	 */
	public function get_default_value();

	public function get_zoom(): int;

	public function get_center_lat(): string;

	public function get_center_lng(): string;

	public function get_vendor_name(): string;

	/**
	 * @return mixed
	 */
	public function get_custom_arg( string $arg_name );

	// setters.

	public function set_is_field_exist( bool $is_field_exist ): void;

	public function set_name( string $name ): void;

	public function set_type( string $type ): void;

	public function set_return_format( string $return_format ): void;

	public function set_display_format( string $display_format ): void;

	/**
	 * @param array<string|int,mixed> $choices
	 */
	public function set_choices( array $choices ): void;

	public function set_is_multiple( bool $is_multiple ): void;

	public function set_is_repeater( bool $is_repeater ): void;

	public function set_self_repeatable_meta( ?Field_Meta_Interface $self_repeatable_meta ): void;

	/**
	 * @param string|string[] $default_value
	 */
	public function set_default_value( $default_value ): void;

	public function set_zoom( int $zoom ): void;

	public function set_center_lat( string $center_lat ): void;

	public function set_center_lng( string $center_lng ): void;

	/**
	 * @param mixed $arg_value
	 */
	public function set_custom_arg( string $arg_name, $arg_value ): void;

	public function unset_custom_arg( string $arg_name ): void;
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wplake.gitbook.io/advanced-views/customization/filters-and-hooks/layout.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
