# Field

### onFieldBeforeDelete

### onFieldAfterDelete

**Description**\
These events are triggered in `CompetitionModelField::delete` (admin). If the plugin returns `false` for `onFieldBeforeDelete` event then the field is not being deleted.

```php
public function onFieldBeforeDelete($context, $table)
{
    // Do something and abort delete
    return false;
}
```

**Arguments**\
`$context` - the context of the event, ‘com\_competition.field’.\
`$table` - a reference to CompetitionTableField object.<br>

### onFieldBeforeSave

### onFieldAfterSave

**Description**\
These events are triggered in `CompetitionModelField::save` (admin). If the plugin returns `false` for `onFieldBeforeSave` event then the filed is not being saved to the database.

```php
public function onFieldAfterSave($context, $table, $isNew)
{
    // Do something
    return;
}
```

**Arguments**\
`$context` - the context of the event, ‘com\_competition.field’.\
`$table` - a reference to CompetitionTableField object.\
`$isNew` - true for new field, false otherwise.

### onFieldChangeState

**Description**\
This evenr is triggered in `CompetitionModeField::publish` (admin) after field has its state changed.

```php
public function onFieldChangeState($context, $pks, $value)
{
    // Do something
    return;
}
```

**Arguments**\
`$context` - the context of the event, ‘com\_competition.field’.\
`$pks` - a list of the primary keys to change.\
`$value` - the value of the state.
