File tree Expand file tree Collapse file tree 3 files changed +60
-1
lines changed
Classes/Migration/Transformation
Migrations/ContentRepository Expand file tree Collapse file tree 3 files changed +60
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Flowpack \SeoRouting \Migration \Transformation ;
6+
7+ use Neos \ContentRepository \Domain \Model \NodeData ;
8+ use Neos \ContentRepository \Migration \Transformations \AbstractTransformation ;
9+
10+ class PropertyValueToLowercase extends AbstractTransformation
11+ {
12+ private string $ propertyName ;
13+
14+ public function setProperty (string $ propertyName ): void
15+ {
16+ $ this ->propertyName = $ propertyName ;
17+ }
18+
19+ /**
20+ * @inheritDoc
21+ */
22+ public function isTransformable (NodeData $ node )
23+ {
24+ return $ node ->hasProperty ($ this ->propertyName );
25+ }
26+
27+ /**
28+ * @inheritDoc
29+ */
30+ public function execute (NodeData $ node )
31+ {
32+ $ currentPropertyValue = $ node ->getProperty ($ this ->propertyName );
33+ $ newPropertyValue = strtolower ($ currentPropertyValue );
34+ $ node ->setProperty ($ this ->propertyName , $ newPropertyValue );
35+ }
36+ }
Original file line number Diff line number Diff line change 1+ up :
2+ comments : ' Transforms all uriPathSegment values to lowercase'
3+ warnings : ' As this migration removes the distinction between uppercase and lowercase it might not be cleanly undone by the down migration.'
4+ migration :
5+ - filters :
6+ - type : ' NodeType'
7+ settings :
8+ nodeType : ' Neos.Neos:Document'
9+ withSubTypes : TRUE
10+ transformations :
11+ - type : ' Flowpack\SeoRouting\Migration\Transformation\PropertyValueToLowercase'
12+ settings :
13+ property : ' uriPathSegment'
14+
15+ down :
16+ comments : ' No down migration available'
Original file line number Diff line number Diff line change @@ -43,6 +43,12 @@ Just require it via composer:
4343
4444` composer require flowpack/seo-routing `
4545
46+ If you want to use the * toLowerCase* feature you should execute the migration that comes with this package:
47+
48+ ` ./flow node:migrate 20250124153030 --confirmation true `
49+
50+ This migration transforms all the URLs of all your nodes to lowercase. It's irreversible.
51+
4652## Configuration
4753
4854### Standard Configuration
@@ -52,7 +58,8 @@ with / at the end) and do all redirects with a 301 http status.
5258
5359* Note: The lowercase redirect is deactivated by default, because you have to make sure, that there is
5460no Neos page with an ` uriPathSegment ` with camelCase or upperspace letters - this would lead to redirects in the
55- neverland.*
61+ neverland. You can achieve this by running the migration that ships with this package,
62+ see [ installation] ( #installation ) .*
5663
5764```
5865Flowpack:
You can’t perform that action at this time.
0 commit comments