@@ -50,7 +50,7 @@ public function renderTeaser(NodeInterface $node, int $maximumLength = 500): str
50
50
foreach ($ contentNodes as $ contentNode ) {
51
51
foreach ($ contentNode ->getProperties () as $ propertyValue ) {
52
52
if (!is_object ($ propertyValue ) || method_exists ($ propertyValue , '__toString ' )) {
53
- $ stringToTruncate .= $ propertyValue ;
53
+ $ stringToTruncate .= $ propertyValue . PHP_EOL ;
54
54
}
55
55
}
56
56
}
@@ -67,7 +67,7 @@ public function renderTeaser(NodeInterface $node, int $maximumLength = 500): str
67
67
68
68
// If we found a suitable paragraph break, use it
69
69
$ bestEndPosition = max ($ validPositions );
70
- if ($ bestEndPosition !== null ) {
70
+ if ($ bestEndPosition > 0 ) {
71
71
return $ this ->stripUnwantedTags (substr ($ stringToTruncate , 0 , $ bestEndPosition ));
72
72
}
73
73
@@ -82,9 +82,9 @@ public function renderTeaser(NodeInterface $node, int $maximumLength = 500): str
82
82
* Find all positions of '</p>' in the given HTML string.
83
83
*
84
84
* @param string $html
85
- * @return array
85
+ * @return int[]
86
86
*/
87
- protected function getPTagPositions (string $ html ) {
87
+ protected function getPTagPositions (string $ html ): array {
88
88
$ positions = [];
89
89
$ offset = 0 ;
90
90
@@ -96,47 +96,6 @@ protected function getPTagPositions(string $html) {
96
96
return $ positions ;
97
97
}
98
98
99
- /**
100
- * @param NodeInterface $node
101
- * @return string
102
- * @throws NodeException
103
- */
104
- public function renderContent (NodeInterface $ node ): string
105
- {
106
- $ content = '' ;
107
- $ childNodes = $ this ->getContentNodesFromMainCollection ($ node );
108
-
109
- /** @var NodeInterface $contentNode */
110
- foreach ($ childNodes as $ contentNode ) {
111
- if ($ contentNode ->getNodeType ()->isOfType ('Neos.NodeTypes:TextWithImage ' )) {
112
- $ propertyValue = $ contentNode ->getProperty ('image ' );
113
- $ attributes = [
114
- 'width=" ' . $ propertyValue ->getWidth () . '" ' ,
115
- 'height=" ' . $ propertyValue ->getHeight () . '" ' ,
116
- 'src=" ' . $ this ->resourceManager ->getPublicPersistentResourceUri ($ propertyValue ->getResource ()) . '" '
117
- ];
118
- $ content .= $ contentNode ->getProperty ('text ' );
119
- $ content .= '<img ' . implode (' ' , $ attributes ) . '/> ' ;
120
- } elseif ($ contentNode ->getNodeType ()->isOfType ('Neos.NodeTypes:Image ' )) {
121
- $ propertyValue = $ contentNode ->getProperty ('image ' );
122
- $ attributes = [
123
- 'width=" ' . $ propertyValue ->getWidth () . '" ' ,
124
- 'height=" ' . $ propertyValue ->getHeight () . '" ' ,
125
- 'src=" ' . $ this ->resourceManager ->getPublicPersistentResourceUri ($ propertyValue ->getResource ()) . '" '
126
- ];
127
- $ content .= '<img ' . implode (' ' , $ attributes ) . '/> ' ;
128
- } else {
129
- foreach ($ contentNode ->getProperties () as $ propertyValue ) {
130
- if (!is_object ($ propertyValue ) || method_exists ($ propertyValue , '__toString ' )) {
131
- $ content .= $ propertyValue ;
132
- }
133
- }
134
- }
135
- }
136
-
137
- return $ this ->stripUnwantedTags ($ content );
138
- }
139
-
140
99
/**
141
100
* @param NodeInterface $node
142
101
* @return TraversableNodes
0 commit comments