0

For certain entries I would like to be able to override how Craft generates the URLs to them. So I create an Entry Model in my module extending from \craft\elements\Entry and override the getUrl() method there.

However I did not manage to replace Craft's class with mine.

How can I achieve this? I found solutions like Yii::$container->set('craft\elements\Entry', '\modules\Entry'); or the same with Craft::

I placed it in my index.php, I tried it in the head of /config/app.php, but nothing happened.

Any suggestions?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.