You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To build a clean description, we need to have the xlanguage processing for the string field to be run.
I am thinking a preload could help out with this.
We could add a preload that would do the language based selection to xlanguage, and trigger an event in Metagen to condition the string before processing. If xlanguage is not installed there would be no processing, and no changes would be made to the string.
This method does not work with xlanguage. With the first language, no problem but if we activate the second then Xoops crashes.
To avoid the problem I wrote this in my module:
$xoTheme->addMeta('meta', 'description', \Xmf\Metagen::generateDescription(preg_replace("/\[.*?\]/", '', $content->getVar('content_text')), 30));
I don't know if it's really good what I'm doing. We can add this code to the method "asPlainText()"
$text = preg_replace('/\[.*?\]/', ' ', $text);
The full code:
The text was updated successfully, but these errors were encountered: