- πΊπΈUnited States jphelan
Similar issue. I have a custom entity type mentor_session and the correct add link is
/ns-entity/add/mentor_session
But double clicking in a day opens/add/%7Bns_entity_type%7D?start=2024-09-03&start_field=field_session_date
. Is there a way to override this? - π¦πΊAustralia mingsong π¦πΊ
The bundle type is specified in the following line
https://git.drupalcode.org/project/fullcalendar_view/-/blob/5.x/src/Full...
And there is a setting to specify the 'Bundle type' to be created.
But it works with Node entity. Not sure about how it works with your custom entity type.
- πΊπΈUnited States jphelan
Ok, thanks I'll check how we are defining that in our entity as I do have the event bundle selected.
- πΊπΈUnited States jphelan
I think it's because for the create link it needs "_type"
Updating line 100 to this solved it for me.
if (isset($entity_links['add-form'])) { $add_form = str_replace('{' . $entity_type->id() . '_type}', $event_bundle_type, $entity_links['add-form']); } elseif (isset($entity_links['add-page'])) { $add_form = str_replace('{' . $entity_type->id() . '_type}', $event_bundle_type, $entity_links['add-page']); }
However the link is missing the site domain for me still open it opens in a new window.
http://ns-entity/add/mentor_session?start=2024-09-10
- π¦πΊAustralia mingsong π¦πΊ
I don't know why your custom entity need the '_type' at the end.
Let me take the Media entity from core as an example.
https://git.drupalcode.org/project/drupal/-/blob/10.3.x/core/modules/med...
The '_type' suffix is not mentioned in the Drupal entity API β , if we hard-code this in a contribute module, it won't work for others.
- πΊπΈUnited States jphelan
Both the links you sent show "_type" added after the entity type name for the add form links. Because those links contain the entity type name link /node/add/article or /node/add/page instead of the entity id like canonical and edit-form links.
https://www.drupal.org/docs/drupal-apis/entity-api/introduction-to-entity-api-in-drupal-8#s-full-handlers-example β
$entity_type->id() returns the entity type name like "node" or "commerce_product" so the str_replace in line 100 is looking for {commerce_product} instead of {commerce_product_type} to replace in add-form link. I just tested with a view of commerce_product entities and it works with the patch and does not work correctly without it.