@@ -409,21 +409,25 @@ The attribute ``app_path`` will contain the name of the application handling the
409
409
Modifying an existing toolbar
410
410
*****************************
411
411
412
- If you need to modify an existing toolbar (say to change the ``supported_apps `` attribute) you can
413
- do this by extending the original one, and modifying the appropriate attribute.
412
+ If you need to modify an existing toolbar (say to change an attribute or the behaviour of a method)
413
+ you can do this by creating a sub-class of it that implements the required changes, and registering
414
+ that instead of the original.
414
415
415
- If :setting: `CMS_TOOLBARS ` is used to register the toolbars, add your own toolbar instead of the
416
- original one, otherwise unregister the original and register your own::
416
+ The original can be unregistered using ``toolbar_pool.unregister() ``, as in the example below.
417
+ Alternatively if you orginally invoked the toolbar class using :setting: `CMS_TOOLBARS `, you will
418
+ need to modify that to refer to the new one instead.
419
+
420
+ An example, in which we unregister the original and register our own::
417
421
418
422
419
423
from cms.toolbar_pool import toolbar_pool
420
424
from third_party_app.cms_toolbar import ThirdPartyToolbar
421
425
422
426
@toolbar_pool.register
423
427
class MyBarToolbar(ThirdPartyToolbar):
424
- supported_apps = ('third_party_app', 'my_app')
428
+ [...]
425
429
426
- toolbar_pool.unregister(FooToolbar )
430
+ toolbar_pool.unregister(ThirdPartyToolbar )
427
431
428
432
429
433
.. _url_changes :
0 commit comments