|
26 | 26 | * @method string getIdentifier()
|
27 | 27 | * @method $this setIdentifier(string $value)
|
28 | 28 | * @method string getContent()
|
| 29 | + * @method string getShortContent() |
29 | 30 | * @method $this setContent(string $value)
|
30 | 31 | * @method string getContentHeading()
|
31 | 32 | * @method $this setContentHeading(string $value)
|
@@ -383,35 +384,41 @@ public function getShortFilteredContent()
|
383 | 384 | {
|
384 | 385 | $key = 'short_filtered_content';
|
385 | 386 | if (!$this->hasData($key)) {
|
386 |
| - $content = $this->getFilteredContent(); |
387 |
| - $pageBraker = '<!-- pagebreak -->'; |
388 |
| - |
389 |
| - $p = mb_strpos($content, $pageBraker); |
390 |
| - if (!$p) { |
391 |
| - $p = (int) $this->scopeConfig->getValue( |
392 |
| - 'mfblog/post_list/shortcotent_length', |
393 |
| - \Magento\Store\Model\ScopeInterface::SCOPE_STORE |
| 387 | + if ($this->getShortContent()) { |
| 388 | + $content = $this->filterProvider->getPageFilter()->filter( |
| 389 | + $this->getShortContent() |
394 | 390 | );
|
395 |
| - } |
| 391 | + } else { |
| 392 | + $content = $this->getFilteredContent(); |
| 393 | + $pageBraker = '<!-- pagebreak -->'; |
| 394 | + |
| 395 | + $p = mb_strpos($content, $pageBraker); |
| 396 | + if (!$p) { |
| 397 | + $p = (int)$this->scopeConfig->getValue( |
| 398 | + 'mfblog/post_list/shortcotent_length', |
| 399 | + \Magento\Store\Model\ScopeInterface::SCOPE_STORE |
| 400 | + ); |
| 401 | + } |
396 | 402 |
|
397 |
| - if ($p) { |
398 |
| - $content = mb_substr($content, 0, $p); |
399 |
| - try { |
400 |
| - libxml_use_internal_errors(true); |
401 |
| - $dom = new \DOMDocument(); |
402 |
| - $dom->loadHTML('<?xml encoding="UTF-8">' . $content); |
403 |
| - $body = $dom->getElementsByTagName('body'); |
404 |
| - if ( $body && $body->length > 0 ) { |
405 |
| - $body = $body->item(0); |
406 |
| - $_content = new \DOMDocument; |
407 |
| - foreach ($body->childNodes as $child){ |
408 |
| - $_content->appendChild($_content->importNode($child, true)); |
| 403 | + if ($p) { |
| 404 | + $content = mb_substr($content, 0, $p); |
| 405 | + try { |
| 406 | + libxml_use_internal_errors(true); |
| 407 | + $dom = new \DOMDocument(); |
| 408 | + $dom->loadHTML('<?xml encoding="UTF-8">' . $content); |
| 409 | + $body = $dom->getElementsByTagName('body'); |
| 410 | + if ($body && $body->length > 0) { |
| 411 | + $body = $body->item(0); |
| 412 | + $_content = new \DOMDocument; |
| 413 | + foreach ($body->childNodes as $child) { |
| 414 | + $_content->appendChild($_content->importNode($child, true)); |
| 415 | + } |
| 416 | + $content = $_content->saveHTML(); |
409 | 417 | }
|
410 |
| - $content = $_content->saveHTML(); |
| 418 | + } catch (\Exception $e) { |
411 | 419 | }
|
412 |
| - } catch (\Exception $e) {} |
| 420 | + } |
413 | 421 | }
|
414 |
| - |
415 | 422 | $this->setData($key, $content);
|
416 | 423 | }
|
417 | 424 |
|
|
0 commit comments