@@ -751,7 +751,7 @@ The same functionality can be achieved with helper views, with less potential pi
751
751
752
752
(classic-ui-reusing-view-template-snippets-or-embedding-another-view-label)=
753
753
754
- # # Reusing view template snippets or embedding another view
754
+ # # Reusing view template snippets (macros) or embedding another view
755
755
756
756
To use the same template code several times you can either:
757
757
@@ -820,9 +820,38 @@ You need to get access to the view in your code if you are:
820
820
- calling a view from inside another view, or
821
821
- calling a view from your unit test code.
822
822
823
- Below are two different approaches for that.
823
+ Below are three different approaches for that.
824
824
825
825
826
+ (classic-ui-view-by-plone-api)=
827
+
828
+ # ## By using `plone.api.content.get_view()`
829
+
830
+ The ` plone.api` provides a method to get a view by its registered name, the context, and the current request.
831
+
832
+ ` ` ` python
833
+ from plone import api
834
+
835
+ portal = api.portal.get ()
836
+ view = api.content.get_view(
837
+ name=' plone' ,
838
+ context=portal[' about' ],
839
+ request=request,
840
+ )
841
+ ` ` `
842
+
843
+ ` ` ` {versionchanged} 2.0.0
844
+ Since version 2.0.0, the request argument can be omitted.
845
+ In that case, the global request will be used.
846
+
847
+ For more details see {ref}` content-get-view-example` .
848
+ ` ` `
849
+
850
+ ` ` ` {note}
851
+ The usage of ` plone.api` in Plone core is limited.
852
+ If in doubt, please use the following methods instead.
853
+ ` ` `
854
+
826
855
(classic-ui-by-using-getmultiadapter-label)=
827
856
828
857
# ## By using `getMultiAdapter()`
0 commit comments