Solution #20 provided by @loopy1492 has answer of the question. Basically issues could be more however the first issue is that you have to take correct class name of the Twig file. We can understand better with below code explanation:
Below code snippet from our custom Twig file "MyCustomUrlFromUri.php" to define a twig filter
class MyCustomUrlFromUri extends AbstractExtension {
/**
* {@inheritdoc}
*/
public function getFilters() {
return [
new TwigFilter('url_from_uri', [$this, 'urlFromUri']),
];
}
And in our custom service file "my_custom.services.yml", you can see...
my_custom.urlfromuri_twig_extension:
class: Drupal\my_custom\Twig\MyCustomUrlFromUri
tags:
- { name: twig.extension }
So far you have noticed that this "MyCustomUrlFromUri" same at three places, so you too keep it same what ever you are taking the name.
I hope it could help you.
Still not working, I am using V1.3 with D10.
ajmaltash → created an issue.
You try to remember what block was you were working or removed by other way or imported, then you can use this code
in any preprocess hook.
\Drupal::configFactory()->getEditable('block.block.YOURPLUGINBLOCKID')->delete();
The same issue also occurred in my Drupal setup, I then was developing a custom module. What I did that after reading few threads I uninstalled my custom module but error was still there. I started checking each file of my module then i saw there was double PHP opening tag '<?php' like this '<?php<?php' in a controller file. I removed one '<?php' and found the error was no more coming there.
Therefore, I would suggest whoso ever is facing such issue need to geekly check all pages of custom module and it will fix the issue. Thanks.