localgovdrupal / localgov_finders

LocalGov Finders (will) help Directories, Events, News, Consultations etc. display, index, and filter their content.
GNU General Public License v2.0
0 stars 0 forks source link

Channel bundles -> Content type option doesn't appear #29

Open rupertj opened 2 hours ago

rupertj commented 2 hours ago

Create a new Finder entity.

Choose the channel bundle entity type. Channel bundle content type does not appear.

If you choose the entry bundle entity type, then change the channel bundle entity type to something else, then back to Content, the Channel bundle content field does appear.

joachim-n commented 2 hours ago

Are there any JS errors in the console? It was working for me, though either I happened to do it in the right order, or I've forgotten to commit a file!

rupertj commented 2 hours ago

Yes there are!

ResponseText: The website encountered an unexpected error. Try again later.Drupal\Component\Plugin\Exception\PluginNotFoundException: The "container" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 142 of core/lib/Drupal/Core/Entity/EntityTypeManager.php). Drupal\finders\Element\EntityBundles::processEntityBundles() call_user_func_array() (Line: 1006)

joachim-n commented 2 hours ago

The "container" entity type does not exist

That sounds like the top-level form element in the custom form element plugin is somehow getting picked up as the value for the entity type.

joachim-n commented 2 hours ago

Can you debug around line 100 of EntityBundles? $selected_entity_type_id is getting set to the wrong thing -- almost certainly because I frankencoded this class from Action Link module....

rupertj commented 1 hour ago

$selected_entity_type_id is getting set to 'container' on line 100, which is the case where it's not including 'container' in the element parents.

The chosen entity_type_is is in the formState's values at: $form_state->values["entries"]["container"]["entity_type_id"];

joachim-n commented 1 hour ago

Thanks!

I know what's gone wrong -- in Action Link I added the method that gets the value for a form element, in an attempt to remove the 'container' nesting from the values -- which doesn't quite work. Without that, there's never a case when it's not nested like that. You can remove that clause completely.