# Contest

### onCompetitionDisplay

**Description**\
This event is triggered in `CompetitionViewCompetition::display` (site).

```php
public function onCompetitionDisplay($context, $item)
{
    // Do something
}
```

**Arguments**\
`$context` - the context of the event, ‘com\_competition.competition’.\
`$item` - the contest object.

### onCompetitionBeforeDelete

### onCompetitionAfterDelete

**Description**\
These plugins are triggered in `CompetitionModelCompetition::delete` (admin). If the plugin returns `false` for `onCompetitionBeforeDelete` event then the contest is not being deleted.

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

**Arguments**\
`$context` - the context of the event, ‘com\_competition.competition’.\
`$table` - a reference to CompetitionTableCompetition object.

### onCompetitionBeforeSave

### onCompetitionAfterSave

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

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

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

### onCompetitionChangeState

**Description**\
Is triggered in `CompetitionModelCompetition::publish` (admin) after field has its state changed.

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

**Arguments**\
`$context` - the context of the event, ‘com\_competition.competition’.\
`$pks` - a list of the primary keys to change.\
`$value` - the value of the state: -2 - deleted; 0 - unpublished; 1 - published.<br>


---

# 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://docs.norrnext.com/norrcompetition/customisation/events/contest.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.
