Define Keywords Event
This event is triggered when saving an Address field.
Native Craft Event
This event is native to Craft. For further details, consult the Craft documentation:
# Properties
Property | Type | Description |
---|---|---|
value | mixed | The Address field's value to be indexed. |
element | ElementInterface | The element whose field is being indexed. |
keywords | string | Custom compiled keywords for Address field. |
handled | bool | Whether the event is handled. |
# Example
use craft\events\DefineFieldKeywordsEvent;
use doublesecretagency\googlemaps\fields\AddressField;
use yii\base\Event;
Event::on(
AddressField::class,
AddressField::EVENT_DEFINE_KEYWORDS,
function (DefineFieldKeywordsEvent $event) {
// Set custom keywords
$event->keywords = 'my custom keywords';
// Mark event as handled
$event->handled = true;
}
);