2014-11-07 20:43:57 +01:00
|
|
|
## Extending existing ModelAdmin
|
|
|
|
|
2016-03-30 02:17:28 +02:00
|
|
|
Sometimes you'll work with ModelAdmins from other modules. To customise these interfaces, you can always subclass. But there's
|
2016-02-17 22:21:59 +01:00
|
|
|
also another tool at your disposal: The [api:Extension] API.
|
2014-11-07 20:43:57 +01:00
|
|
|
|
|
|
|
:::php
|
|
|
|
class MyAdminExtension extends Extension {
|
|
|
|
// ...
|
|
|
|
public function updateEditForm(&$form) {
|
|
|
|
$form->Fields()->push(/* ... */)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Now enable this extension through your `[config.yml](/topics/configuration)` file.
|
|
|
|
|
|
|
|
:::yml
|
|
|
|
MyAdmin:
|
|
|
|
extensions:
|
|
|
|
- MyAdminExtension
|
|
|
|
|
|
|
|
The following extension points are available: `updateEditForm()`, `updateSearchContext()`,
|
2016-02-17 22:21:59 +01:00
|
|
|
`updateSearchForm()`, `updateList()`, `updateImportForm`.
|