Skip to content

Commit 78607de

Browse files
committed
Update field type identifiers to Ibexa 5 variants
1 parent 3a3196c commit 78607de

File tree

7 files changed

+60
-96
lines changed

7 files changed

+60
-96
lines changed

bundle/Handler/FieldType/XmlText.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

bundle/Resources/config/handlers.yaml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,19 @@ services:
3434
class: Netgen\Bundle\OpenGraphBundle\Handler\FieldType\TextLine
3535
parent: netgen_open_graph.handler.field_type.abstract
3636
tags:
37-
- { name: netgen_open_graph.meta_tag_handler, alias: field_type/ezstring }
37+
- { name: netgen_open_graph.meta_tag_handler, alias: field_type/ibexa_string }
3838

3939
netgen_open_graph.handler.field_type.text_block:
4040
class: Netgen\Bundle\OpenGraphBundle\Handler\FieldType\TextBlock
4141
parent: netgen_open_graph.handler.field_type.abstract
4242
tags:
43-
- { name: netgen_open_graph.meta_tag_handler, alias: field_type/eztext }
43+
- { name: netgen_open_graph.meta_tag_handler, alias: field_type/ibexa_text }
4444

4545
netgen_open_graph.handler.field_type.rich_text:
4646
class: Netgen\Bundle\OpenGraphBundle\Handler\FieldType\RichText
4747
parent: netgen_open_graph.handler.field_type.abstract
4848
tags:
49-
- { name: netgen_open_graph.meta_tag_handler, alias: field_type/ezrichtext }
50-
51-
netgen_open_graph.handler.field_type.xml_text:
52-
class: Netgen\Bundle\OpenGraphBundle\Handler\FieldType\XmlText
53-
parent: netgen_open_graph.handler.field_type.abstract
54-
tags:
55-
- { name: netgen_open_graph.meta_tag_handler, alias: field_type/ezxmltext }
49+
- { name: netgen_open_graph.meta_tag_handler, alias: field_type/ibexa_richtext }
5650

5751
netgen_open_graph.handler.field_type.image:
5852
class: Netgen\Bundle\OpenGraphBundle\Handler\FieldType\Image
@@ -62,4 +56,4 @@ services:
6256
- "@request_stack"
6357
- "@?logger"
6458
tags:
65-
- { name: netgen_open_graph.meta_tag_handler, alias: field_type/ezimage }
59+
- { name: netgen_open_graph.meta_tag_handler, alias: field_type/ibexa_image }

bundle/Resources/doc/USAGE.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ netgen_open_graph:
1818
content_type_handlers:
1919
blog_post:
2020
- { handler: literal/text, tag: 'og:type', params: ['article'] }
21-
- { handler: field_type/ezstring, tag: 'og:title', params: ['title'] }
22-
- { handler: field_type/ezimage, tag: 'og:image', params: ['image', 'opengraph'] }
21+
- { handler: field_type/ibexa_string, tag: 'og:title', params: ['title'] }
22+
- { handler: field_type/ibexa_image, tag: 'og:image', params: ['image', 'opengraph'] }
2323
article:
2424
- { handler: literal/text, tag: 'og:type', params: ['article'] }
25-
- { handler: field_type/ezstring, tag: 'og:title', params: ['short_title'] }
26-
- { handler: field_type/ezrichtext, tag: 'og:description', params: ['short_intro'] }
27-
- { handler: field_type/ezimage, tag: 'og:image', params: ['line_image', 'opengraph'] }
25+
- { handler: field_type/ibexa_string, tag: 'og:title', params: ['short_title'] }
26+
- { handler: field_type/ibexa_richtext, tag: 'og:description', params: ['short_intro'] }
27+
- { handler: field_type/ibexa_image, tag: 'og:image', params: ['line_image', 'opengraph'] }
2828
```
2929
3030
What happens here is that each element in `content_type_handlers` array corresponds to one content type in your
@@ -55,15 +55,15 @@ Will result in following meta tag:
5555
<meta property="og:site_name" content="My super cool site" />
5656
```
5757

58-
### field_type/ezstring
58+
### field_type/ibexa_string
5959

6060
This handler will return the value of `TextLine` field type. You can specify the field definition identifier
6161
as a first parameter, and optionally, a fallback value if the field is empty.
6262

6363
The following config:
6464

6565
```yaml
66-
{ handler: field_type/ezstring, tag: 'og:title', params: ['title', 'My fallback title'] }
66+
{ handler: field_type/ibexa_string, tag: 'og:title', params: ['title', 'My fallback title'] }
6767
```
6868

6969
Will result in following meta tag:
@@ -80,15 +80,15 @@ In cases where `title` field is empty, meta tag will look like this:
8080
<meta property="og:title" content="My fallback title" />
8181
```
8282

83-
### field_type/eztext
83+
### field_type/ibexa_text
8484

8585
This handler will return the value of `TextBlock` field type. You can specify the field definition identifier
8686
as a first parameter, and optionally, a fallback value if the field is empty.
8787

8888
The following config:
8989

9090
```yaml
91-
{ handler: field_type/eztext, tag: 'og:description', params: ['short_description', 'My fallback description'] }
91+
{ handler: field_type/ibexa_text, tag: 'og:description', params: ['short_description', 'My fallback description'] }
9292
```
9393

9494
Will result in following meta tag:
@@ -105,15 +105,15 @@ In cases where `short_description` field is empty, meta tag will look like this:
105105
<meta property="og:description" content="My fallback description" />
106106
```
107107

108-
### field_type/ezrichtext
108+
### field_type/ibexa_richtext
109109

110110
This handler will return the value of `RichText` field type. You can specify the field definition identifier
111111
as a first parameter, and optionally, a fallback value if the field is empty.
112112

113113
The following config:
114114

115115
```yaml
116-
{ handler: field_type/ezrichtext, tag: 'og:description', params: ['description', 'My fallback description'] }
116+
{ handler: field_type/ibexa_richtext, tag: 'og:description', params: ['description', 'My fallback description'] }
117117
```
118118

119119
Will result in following meta tag:
@@ -130,7 +130,7 @@ In cases where `description` field is empty, meta tag will look like this:
130130
<meta property="og:description" content="My fallback description" />
131131
```
132132

133-
### field_type/ezimage
133+
### field_type/ibexa_image
134134

135135
This handler will return the path to the image stored in `Image` field type. You can specify the field definition
136136
identifier as a first parameter, and optionally, image variation to use as a second parameter (`opengraph` variation
@@ -139,7 +139,7 @@ will be used by default), and a fallback path to an image if the field is empty.
139139
The following config:
140140

141141
```yaml
142-
{ handler: field_type/ezimage, tag: 'og:image', params: ['image', 'my_variation', 'bundles/site/images/opengraph_default_image.png'] }
142+
{ handler: field_type/ibexa_image, tag: 'og:image', params: ['image', 'my_variation', 'bundles/site/images/opengraph_default_image.png'] }
143143
```
144144

145145
Will result in following meta tag:
@@ -243,7 +243,7 @@ Notice that in case of field value being empty `getFieldValue` method throws
243243
If you need more complicated handling of fallback value, you can also override `getFallbackValue` method. Just like already
244244
implemented `getFieldValue`, the default implementation of this method simply casts second parameter (`$params[1]`) to string.
245245

246-
For example, `ezimage` field type handler has the following custom implementation:
246+
For example, `ibexa_image` field type handler has the following custom implementation:
247247

248248
```php
249249
protected function getFallbackValue(string $tagName, array $params = []): string

tests/DependencyInjection/Compiler/MetaTagHandlersCompilerPassTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function testCompilerPassCollectsValidServices(): void
1919
$this->setDefinition('netgen_open_graph.handler_registry', $handlerRegistry);
2020

2121
$handlerOne = new Definition();
22-
$handlerOne->addTag('netgen_open_graph.meta_tag_handler', ['alias' => 'field_type/eztext']);
22+
$handlerOne->addTag('netgen_open_graph.meta_tag_handler', ['alias' => 'field_type/ibexa_text']);
2323
$this->setDefinition('handler_one', $handlerOne);
2424

2525
$handlerTwo = new Definition();
@@ -32,7 +32,7 @@ public function testCompilerPassCollectsValidServices(): void
3232
'netgen_open_graph.handler_registry',
3333
'addHandler',
3434
[
35-
'field_type/eztext',
35+
'field_type/ibexa_text',
3636
new Reference('handler_one'),
3737
],
3838
);

0 commit comments

Comments
 (0)