The discovery of the plugin handlers doesn't seem to work properly. I wanted to get at all conditional_field plugin handlers in use, but I only get back the 4 plugin handlers which are added through StaticDiscovery.

Source code showing the problem is attached:
- Put the attached ConditionalFieldsMissingDefinitions.txt file in the src directory of conditional_fields and change the extension from txt to php. It doesn't have real functionality, it's just showing the problem.
- In ConditionalFieldsFormHelper.php change the start of function getState() to look like this:

  protected static function getState(EntityFormDisplayInterface $form_display, $dependee, $dependee_form_field, $options, $form_state = NULL) {
    $plugin_cache = ConditionalFieldsMissingDefinitions::getInstance();

- Add content in Drupal using a form that uses ConditionalFields.
- Look at the "Recent Log Messages" in Drupal showing the output. In the output you will see only 4 entries, while I would have expected at least all of the handlers in the "conditional_fields\src\Plugin\conditional_fields\handler" directory to be present.

I'm using Drupal 8.8.2

Comments

sboden created an issue. See original summary.

sboden’s picture

I did some more checking.
- The current dev version (on 22 feb 2020) does not have the behaviour described in the issue, in the dev version all plugins are present in the getDefinitions() output.

However there I see other problems:
- The LinkAddressfield plugin which is under extra_contrib, is using the wrong namespace: it's using the namespace of one 'directory' higher. This is problematic if you want to instantiate plugins based on discovery.
- In the getDefinitions() output the first 4 entries have different fields than the following plugins in the output. The first 4 plugins are the ones also outputted in the class attached to this issue, these don't have a key 'id' in their array. The other plugins in the getDefinitions() output do have a key 'id' in their array.

colan’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Performance

From #3086250-8: This module makes form super slow:

In alpha6 there's another performance problem, this issue #3115279: Plugin handlers don't load properly. For some reason the discovery of the plugins is broken, and so conditional_fields keeps trying to scan the whole filesystem under modules. I had a patch for that too, but since I started from a newer version afterwards, I forgot about that (in a newer version, that was fixed).

It will take me a little bit of time to find that patch again.

So is this still an issue? It's not clear to me if this was already fixed or not.