silverstripe-framework/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/How_Tos/Extending_An_Existing_ModelAdmin.md
2017-10-27 15:38:27 +13:00

745 B

Extending existing ModelAdmin

Sometimes you'll work with ModelAdmins from other modules. To customise these interfaces, you can always subclass. But there's also another tool at your disposal: The Extension API.

use SilverStripe\Core\Extension;

class MyAdminExtension extends Extension 
{
    // ...
    public function updateEditForm(&$form) 
    {
        $form->Fields()->push(/* ... */)
    }
}

Now enable this extension through your [config.yml](/topics/configuration) file.

MyAdmin:
  extensions:
    - MyAdminExtension

The following extension points are available: updateEditForm(), updateSearchContext(), updateSearchForm(), updateList(), updateImportForm.