Use OutputFilter::stringUrlSafe
Get an safe string returned
Error Message:
Attempted to load class "Transliterate" from namespace "Joomla\Language".\n
Did you forget a "use" statement for another namespace?
"""
#code: 0
#file: "/srv/www//libraries/vendor/joomla/filter/src/OutputFilter.php"
#line: 130
Joomla 4.1.0
Change from
130: $str = StringHelper::strtolower((new Transliterate)->utf8_latin_to_ascii($string));
to
130: $str = StringHelper::strtolower((new \Joomla\CMS\Language\Transliterate())->utf8_latin_to_ascii($string));
or include it in the "use" statements
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
I am using this in an external cronjob. To include Language there would be a solution but in my opinion the class itself should "require" all needed resources.
And in all naivety, how can I possible know that OutputFilter does need Language.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-11-13 10:11:56 |
Closed_By | ⇒ | joomdonation |
Sorry for lately response. The solution is using OutputFilter from CMS package instead of from framework package (The OutputFilter from Joomla framework has optional dependency from Language package but it is not required in our CMS). In short, use something like:
use Joomla\CMS\Filter\OutputFilter;
OutputFilter::stringURLSafe($tring);
I'm closing this issue for now.
Where are you using the function?
Maybe you forgot to add
use \Joomla\CMS\Language\
in your code?