@@ -560,10 +560,35 @@ you can do the following::
560
560
561
561
If the plugin prefix is omitted, the layout/view file will be located normally.
562
562
563
+ Plugin Elements
564
+ ---------------
565
+
566
+ To render an element from a plugin, use the :term: `plugin syntax ` to reference
567
+ a plugin. You do not need to use plugin syntax for elements in the current active plugin.
568
+
569
+ If the element doesn't exist in the plugin, it will look in the main APP
570
+ folder::
571
+
572
+ echo $this->element('Contacts.helpbox');
573
+
574
+ If your view is a part of a plugin, you can omit the plugin name. For example,
575
+ if you are in the ``ContactsController `` of the Contacts plugin, the following::
576
+
577
+ echo $this->element('helpbox');
578
+ // and
579
+ echo $this->element('Contacts.helpbox');
580
+
581
+ are equivalent and will result in the same element being rendered.
582
+
583
+ For elements inside subfolder of a plugin
584
+ (for example, **plugins/Contacts/Template/element/sidebar/helpbox.php **), use the
585
+ following::
586
+
587
+ echo $this->element('Contacts.sidebar/helpbox');
588
+
563
589
.. note ::
590
+ See :ref: `view-elements ` for more information on rendering elements.
564
591
565
- For information on how to use elements from a plugin, look up
566
- :ref: `view-elements `
567
592
568
593
Overriding Plugin Templates from Inside Your Application
569
594
--------------------------------------------------------
@@ -579,6 +604,13 @@ Contacts controller you could make the following file::
579
604
Creating this file would allow you to override
580
605
**plugins/ContactManager/templates/Contacts/index.php **.
581
606
607
+ To override plugin elements, create an element with the same name in::
608
+
609
+ templates/plugin/ContactManager/element/helpbox.php
610
+
611
+ This file would override
612
+ **plugins/ContactManager/tempaltes/element/helpbox.ctp **.
613
+
582
614
If your plugin is in a composer dependency (i.e. 'Company/ContactManager'), the
583
615
path to the 'index' view of the Contacts controller will be::
584
616
0 commit comments