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).

Command icon 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

psaleks created an issue. See original summary.

himanshu_jhaloya made their first commit to this issue’s fork.

himanshu_jhaloya’s picture

Assigned: Unassigned » himanshu_jhaloya

himanshu_jhaloya’s picture

Assigned: himanshu_jhaloya » Unassigned
Status: Active » Needs review

Created the MR. fixed the issue. Please Review.

nigelcunningham’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me, successfully tested.

enxox’s picture

Does 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

mbuechner’s picture

I Think, the Problem here is that Formatter::getDependentEntities() calls findConfigEntityDependenciesAsEntities() 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()]);

deciphered’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in 4.1.x

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.