Problem
Does not work with drupal 10, php 8.2.12
Steps to reproduce
Install drupal 10. Install only Custom Formatters.
Go to /admin/structure/formatters.
Page displays two empty lines of table with operation buttons and create 4 warnings: First one is
Warning: Undefined array key "" in Drupal\custom_formatters\FormatterListBuilder->buildRow() (line 70 of /home/tmmservices/subdomains/peter/modules/custom_formatters/src/FormatterListBuilder.php)
Delete empty lines. Warnings disappeared.
Click add Formatter. Page displayed options (Formatter preset...).
Click on any options created warning and error:
Warning: Undefined property: Drupal\Core\Config\ConfigManager::$ConfigManagerInterface in Drupal\custom_formatters\Entity\Formatter->getDependentEntities() (line 107 of /home/tmmservices/subdomains/peter/modules/custom_formatters/src/Entity/Formatter.php)
Error: Class name must be a valid object or a string in Drupal\custom_formatters\Entity\Formatter->getDependentEntities() (line 107 of /home/tmmservices/subdomains/peter/modules/custom_formatters/src/Entity/Formatter.php).
Issue fork custom_formatters-3404747
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
himanshu_jhaloya commentedComment #5
himanshu_jhaloya commentedCreated the MR. fixed the issue. Please Review.
Comment #6
nigelcunningham commentedLooks good to me, successfully tested.
Comment #7
enxox commentedDoes not work for me.
Drupal 10.5.6, tested both on 4.0.0 beta and 4.0.1
AH01071: Got error 'PHP message: Uncaught PHP Exception Symfony\\Component\\Routing\\Exception\\MissingMandatoryParametersException: "Some mandatory parameters are missing ("custom_formatter") to generate a URL for route "entity.formatter.devel_load"." at /var/www/vhosts/sicamera.it/openg.com/web/core/lib/Drupal/Core/Routing/UrlGenerator.php line 187', referer: https://openg.com/admin/structure
Comment #8
mbuechner commentedI Think, the Problem here is that
Formatter::getDependentEntities()callsfindConfigEntityDependenciesAsEntities()with incorrect static/interface syntax, causing a fatal error on Drupal 10 in dependency-related UI/actions.Fix: In src/Entity/Formatter.php, call the method on the service instance:
replace the static/interface-style call with
$config_manager->findConfigEntityDependenciesAsEntities('config', [$this->getConfigDependencyName()]);Comment #9
decipheredFixed in 4.1.x