AbstractEntity
AbstractEntity class, which initself implments EntityInterface.
AbstactEntity injects the currently selected provider into the entity, which can be accessed via $this->provider.
The search provider currently selected in the search settings.
An array of fields that should be searchable, this is used by the provider to
index said fields.
An array of fields that should be displayed, this is used by the provider to
return only the needed fields.
Returns an array of fields that should be searchable, this is used by the
provider to index said fields. This method can be overridden to return a
different array of fields via filters.
Returns an array of fields that should be displayed, this is used by the
provider to return only the needed fields. This method can be overridden to
return a different array of fields via filters.
EntityInterface
Returns a unique slug for the entity, to avoid dubplicates, this should be
whatever slug WordPress will use, like a custom post type or taxonomy or user
role.
Returns a plural, human readable, transatable name for the entity.
Should be where hooks to create, update, and delete items for this entity are
registred. This is called for enabled entities.
This is relevant if you’re using the default provider, this method will search
the entity based on a search query.
Should take an entity object (WC_Order, WC_Customer, WC_Product…) and
returns an array of which data to persist, and what data to display in the
search results, returns an object of properties and values, the same keys are
used in layout, searchable_fields and display_fields.
Returns an array that describes which template to use, how to bind its values,
and what actions to use. The array has the following shape:
Layout
Layout
A layout function must return an array with the following shape:
The class name of the template to use. Read more about templates
here.
An array that describes what value to bind to which placeholder in the
template.Bindings can be icons, images, single text, or several text values that gets merged.
An array that describes what actions to use, for now, actions are limited to
full redirect, future versions will include internal redirects (inside the
search bar).
Batchable
Batchable contract, which require a single method:
Takes current pagination and returns an array of length
$per_page and items
of get_item_data array shape.