From ec2cb6a77483ce9c0b0845041d43f11f3ab1f89f Mon Sep 17 00:00:00 2001 From: Samuel Asor <8720569+sammyskills@users.noreply.github.com> Date: Tue, 22 Aug 2023 09:58:50 +0100 Subject: [PATCH 1/6] Fixed typo in docs/view-parser --- user_guide_src/source/outgoing/view_parser/023.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/view_parser/023.php b/user_guide_src/source/outgoing/view_parser/023.php index 1bdb256d92f1..e63613b44763 100644 --- a/user_guide_src/source/outgoing/view_parser/023.php +++ b/user_guide_src/source/outgoing/view_parser/023.php @@ -1,3 +1,3 @@ render('myview'); +return $parser->renderString($template); From 1024589255dbe7d20c35abcbd3842ad8088a8a27 Mon Sep 17 00:00:00 2001 From: Samuel Asor <8720569+sammyskills@users.noreply.github.com> Date: Tue, 22 Aug 2023 10:45:43 +0100 Subject: [PATCH 2/6] Applied code review suggestion --- user_guide_src/source/outgoing/view_parser/023.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/outgoing/view_parser/023.php b/user_guide_src/source/outgoing/view_parser/023.php index e63613b44763..8e65d489f492 100644 --- a/user_guide_src/source/outgoing/view_parser/023.php +++ b/user_guide_src/source/outgoing/view_parser/023.php @@ -1,3 +1,3 @@ renderString($template); +return $parser->renderString(''); From c8b932baad66cb1679cbc61f2998e27cd81e33b9 Mon Sep 17 00:00:00 2001 From: Samuel Asor <8720569+sammyskills@users.noreply.github.com> Date: Tue, 22 Aug 2023 11:48:44 +0100 Subject: [PATCH 3/6] Update view parser filters doc --- user_guide_src/source/outgoing/view_parser.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/outgoing/view_parser.rst b/user_guide_src/source/outgoing/view_parser.rst index 206cebdd2698..43b2848df640 100644 --- a/user_guide_src/source/outgoing/view_parser.rst +++ b/user_guide_src/source/outgoing/view_parser.rst @@ -426,7 +426,7 @@ Custom Filters -------------- You can easily create your own filters by editing **app/Config/View.php** and adding new entries to the -``$filters`` array. Each key is the name of the filter is called by in the view, and its value is any valid PHP +``$filters`` array. Each key is the name which the filter is called by in the view, and its value is any valid PHP callable: .. literalinclude:: view_parser/012.php @@ -435,8 +435,8 @@ PHP Native functions as Filters ------------------------------- You can use native php function as filters by editing **app/Config/View.php** and adding new entries to the -``$filters`` array.Each key is the name of the native PHP function is called by in the view, and its value is any valid native PHP -function prefixed with: +``$filters`` array. Each key is the name which the native PHP function is called by in the view, and its value is any valid native PHP +function prefixed with ``\``: .. literalinclude:: view_parser/013.php From 6f5e794fcd7e8b704986fcbf97eb054c33f00f10 Mon Sep 17 00:00:00 2001 From: Samuel Asor <8720569+sammyskills@users.noreply.github.com> Date: Tue, 22 Aug 2023 23:17:30 +0100 Subject: [PATCH 4/6] Update user_guide_src/source/outgoing/view_parser.rst Co-authored-by: kenjis --- user_guide_src/source/outgoing/view_parser.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/user_guide_src/source/outgoing/view_parser.rst b/user_guide_src/source/outgoing/view_parser.rst index 43b2848df640..d913c1ebf917 100644 --- a/user_guide_src/source/outgoing/view_parser.rst +++ b/user_guide_src/source/outgoing/view_parser.rst @@ -435,8 +435,7 @@ PHP Native functions as Filters ------------------------------- You can use native php function as filters by editing **app/Config/View.php** and adding new entries to the -``$filters`` array. Each key is the name which the native PHP function is called by in the view, and its value is any valid native PHP -function prefixed with ``\``: +``$filters`` array. Each key is the name which the PHP function is called by in the view, and its value is any valid PHP function: .. literalinclude:: view_parser/013.php From c7f7bf2a93f46c30bfa0a693d2687e751005910b Mon Sep 17 00:00:00 2001 From: Samuel Asor <8720569+sammyskills@users.noreply.github.com> Date: Wed, 23 Aug 2023 05:06:45 +0100 Subject: [PATCH 5/6] Update custom filters sample code --- user_guide_src/source/outgoing/view_parser/012.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/outgoing/view_parser/012.php b/user_guide_src/source/outgoing/view_parser/012.php index 000642837149..696bd2d29c22 100644 --- a/user_guide_src/source/outgoing/view_parser/012.php +++ b/user_guide_src/source/outgoing/view_parser/012.php @@ -7,8 +7,8 @@ class View extends BaseView { public $filters = [ - 'abs' => '\CodeIgniter\View\Filters::abs', - 'capitalize' => '\CodeIgniter\View\Filters::capitalize', + 'foo' => '\Some\Class::methodName', + 'str_repeat' => 'str_repeat', // native php function ]; // ... From afe45d2f44e3e12c7b075318e8b622e5442650d5 Mon Sep 17 00:00:00 2001 From: Samuel Asor <8720569+sammyskills@users.noreply.github.com> Date: Wed, 23 Aug 2023 05:10:00 +0100 Subject: [PATCH 6/6] Removed PHP Native Function as a Filter content from the docs, as it is already covered in Custom Filters. --- user_guide_src/source/outgoing/view_parser.rst | 8 -------- 1 file changed, 8 deletions(-) diff --git a/user_guide_src/source/outgoing/view_parser.rst b/user_guide_src/source/outgoing/view_parser.rst index d913c1ebf917..1c09d8c36486 100644 --- a/user_guide_src/source/outgoing/view_parser.rst +++ b/user_guide_src/source/outgoing/view_parser.rst @@ -431,14 +431,6 @@ callable: .. literalinclude:: view_parser/012.php -PHP Native functions as Filters -------------------------------- - -You can use native php function as filters by editing **app/Config/View.php** and adding new entries to the -``$filters`` array. Each key is the name which the PHP function is called by in the view, and its value is any valid PHP function: - -.. literalinclude:: view_parser/013.php - Parser Plugins ==============