Skip to content

filters

Alberto Parziale edited this page Apr 28, 2020 · 3 revisions

Filters

Want to manipulate fields while you're saving or fetching them? Aeria keeps you covered. You can filter fields while saving them, or getting them.

Add template for render engine

aeria_register_template

It allows to manipulate the array of template paths for the render engine.

Manipulate configuration

aeria_register_configs

It allows to manipulate the array of aeria config paths.

aeria_transform_config

It allows to manipulate the aeria configuration after all sub-transformation.

aeria_transform_section_ + sectionID

It allows to manipulate a section configuration retrieved by its id.

aeria_before_transform_field_base

It is called on every field and it allows to manipulate its configuration before base transformation (aeria exposes some "virtual" fields that require a conversion to a real field, like the relation field that is converted to select).

aeria_before_transform_field_ + fieldID

It allows to manipulate a field configuration retrieved by its id before base transformation.

aeria_before_transform_field_ + contextID + fieldID

It allows to manipulate a field configuration retrieved by its id and context (e.g. aeria-meta-METAID-FIELDID) before base transformation.

aeria_after_transform_field_base

It is called on every field and it allows to manipulate its configuration after base transformation.

aeria_after_transform_field_ + fieldID

It allows to manipulate a field configuration retrieved by its id after base transformation.

aeria_after_transform_field_ + contextID + fieldID

It allows to manipulate a field configuration retrieved by its id and context (e.g. aeria-meta-METAID-FIELDID) after base transformation.

Manipulate save data

aeria_set_ + contextID + fieldID

It allows to manipulate a value before it is saved.

add_filter("aeria_set_metaexample-input-textarea", function ($value, $config){
  return "I have hijacked this field's value!";
}, 10, 2);

Manipulate admin data

aeria_get_admin_base

It allows to manipulate a field configuration before it is passed to the admin interface.

aeria_get_admin_ + fieldID

It allows to manipulate a field configuration retrieved by its id before it is passed to the admin interface.

aeria_get_admin_ + contextID + fieldID

It allows to manipulate a field configuration retrieved by its id and context (e.g. aeria-meta-METAID-FIELDID) before it is passed to the admin interface.

Manipulate field value

aeria_get_base

It allows to manipulate a field value retrieved before it is returned.

aeria_get_ + contextID + fieldID

It allows to manipulate a field value retrieved by its id and context (e.g. aeria-meta-METAID-FIELDID) before it is passed to the interface.

add_filter("aeria_get_metaexample-input-textarea", function ($value, $config){
  return $value."edited";
}, 10, 2);
Manipulate value by field type

You can also manipulate field value by field type:

  • aeria_get_daterange
  • aeria_get_fieldset
  • aeria_get_gallery
  • aeria_get_maps
  • aeria_get_media
  • aeria_get_picture
  • aeria_get_relation
  • aeria_get_repeater
  • aeria_get_sections
  • aeria_get_select
  • aeria_get_switch
Clone this wiki locally