File tree Expand file tree Collapse file tree 3 files changed +28
-23
lines changed
Expand file tree Collapse file tree 3 files changed +28
-23
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
1818
1919 parts : # e.g. this maps to perms_parts in User/Group database
2020 group : " data"
21- label : " {{part}} "
21+ label : " [[Part]] "
2222 operations : # Here are all possible operations are listed => the op name is mapped to bit value
2323 read :
2424 label : " perm.read"
@@ -71,7 +71,7 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
7171
7272
7373 storelocations : &PART_CONTAINING
74- label : " {{storage_location}} "
74+ label : " [[Storage_location]] "
7575 group : " data"
7676 operations :
7777 read :
@@ -103,39 +103,39 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
103103
104104 footprints :
105105 << : *PART_CONTAINING
106- label : " {{footprint}} "
106+ label : " [[Footprint]] "
107107
108108 categories :
109109 << : *PART_CONTAINING
110- label : " {{category}} "
110+ label : " [[Category]] "
111111
112112 suppliers :
113113 << : *PART_CONTAINING
114- label : " {{supplier}} "
114+ label : " [[Supplier]] "
115115
116116 manufacturers :
117117 << : *PART_CONTAINING
118- label : " {{manufacturer}} "
118+ label : " [[Manufacturer]] "
119119
120120 projects :
121121 << : *PART_CONTAINING
122- label : " {{project}} "
122+ label : " [[Project]] "
123123
124124 attachment_types :
125125 << : *PART_CONTAINING
126- label : " {{attachment_type}} "
126+ label : " [[Attachment_type]] "
127127
128128 currencies :
129129 << : *PART_CONTAINING
130- label : " {{currency}} "
130+ label : " [[Currency]] "
131131
132132 measurement_units :
133133 << : *PART_CONTAINING
134- label : " {{measurement_unit}} "
134+ label : " [[Measurement_unit]] "
135135
136136 part_custom_states :
137137 << : *PART_CONTAINING
138- label : " {{part_custom_state}} "
138+ label : " [[Part_custom_state]] "
139139
140140 tools :
141141 label : " perm.part.tools"
Original file line number Diff line number Diff line change @@ -60,14 +60,18 @@ public function getSynonymPlaceholders(): array
6060
6161 //Generate a placeholder for each element type
6262 foreach (ElementTypes::cases () as $ elementType ) {
63- //We have a placeholder for singular
64- $ placeholders ['{ ' . $ elementType ->value . '} ' ] = $ this ->typeNameGenerator ->typeLabel ($ elementType );
65- //We have a placeholder for plural
66- $ placeholders ['{{ ' . $ elementType ->value . '}} ' ] = $ this ->typeNameGenerator ->typeLabelPlural ($ elementType );
63+ // Get the capitalized labels
64+ $ capitalizedSingular = $ this ->typeNameGenerator ->typeLabel ($ elementType );
65+ $ capitalizedPlural = $ this ->typeNameGenerator ->typeLabelPlural ($ elementType );
66+
67+ // Curly braces for lowercase versions
68+ $ placeholders ['{ ' . $ elementType ->value . '} ' ] = mb_strtolower ($ capitalizedSingular );
69+ $ placeholders ['{{ ' . $ elementType ->value . '}} ' ] = mb_strtolower ($ capitalizedPlural );
6770
68- //And we have lowercase versions for both
69- $ placeholders ['[ ' . $ elementType ->value . '] ' ] = mb_strtolower ($ this ->typeNameGenerator ->typeLabel ($ elementType ));
70- $ placeholders ['[[ ' . $ elementType ->value . ']] ' ] = mb_strtolower ($ this ->typeNameGenerator ->typeLabelPlural ($ elementType ));
71+ // Square brackets for capitalized versions (with capital first letter in placeholder)
72+ $ capitalizedKey = ucfirst ($ elementType ->value );
73+ $ placeholders ['[ ' . $ capitalizedKey . '] ' ] = $ capitalizedSingular ;
74+ $ placeholders ['[[ ' . $ capitalizedKey . ']] ' ] = $ capitalizedPlural ;
7175 }
7276
7377 return $ placeholders ;
Original file line number Diff line number Diff line change @@ -40,10 +40,11 @@ public function testGetSynonymPlaceholders(): void
4040 $ placeholders = $ this ->listener ->getSynonymPlaceholders ();
4141
4242 $ this ->assertIsArray ($ placeholders );
43- $ this ->assertSame ('Part ' , $ placeholders ['{part} ' ]);
44- $ this ->assertSame ('Parts ' , $ placeholders ['{{part}} ' ]);
45- //Lowercase versions:
46- $ this ->assertSame ('part ' , $ placeholders ['[part] ' ]);
47- $ this ->assertSame ('parts ' , $ placeholders ['[[part]] ' ]);
43+ // Curly braces for lowercase versions
44+ $ this ->assertSame ('part ' , $ placeholders ['{part} ' ]);
45+ $ this ->assertSame ('parts ' , $ placeholders ['{{part}} ' ]);
46+ // Square brackets for capitalized versions (with capital first letter in placeholder)
47+ $ this ->assertSame ('Part ' , $ placeholders ['[Part] ' ]);
48+ $ this ->assertSame ('Parts ' , $ placeholders ['[[Part]] ' ]);
4849 }
4950}
You can’t perform that action at this time.
0 commit comments