Closed (fixed)
Project:
FullCalendar
Version:
3.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Jul 2025 at 14:01 UTC
Updated:
30 Jul 2025 at 05:59 UTC
Jump to comment: Most recent
I created a calendar using a new content type 'event'. If I give a role 'Create new content' permission for 'event', I can't double-click on a day to add a new event. Seems that accessManager permission check is hard-coded for node_type 'article' on line 328 of src/Plugin/views/style/FullCalendar.php:
// Drupal events.
$events = $this->prepareEvents();
if ($events) {
$settings['options']['eventSources'][] = $events;
}
$settings['entityType'] = $this->view->getBaseEntityType()->id();
if (!empty($settings['bundle_type'])) {
// Can the user add a new event?
if ($settings['entityType'] === 'node') {
if ($this->accessManager->checkNamedRoute('node.add', ['node_type' => 'article'])) {
$settings['addLink'] = 'node/add/' . $settings['bundle_type'];
}
}
else {
$entity_type = $this->view->getBaseEntityType();
$entity_links = $entity_type->get('links');
if (isset($entity_links['add-form'])) {
$settings['addLink'] = str_replace('{' . $entity_type->id() . '}', $settings['bundle_type'], $entity_links['add-form']);
}
elseif (isset($entity_links['add-page'])) {
$settings['addLink'] = str_replace('{' . $entity_type->id() . '}', $settings['bundle_type'], $entity_links['add-page']);
}
}
}
Change the accessManager check to take into account other content types. I have a patch that works; I'll create a fork.
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 #2
mkindred commentedFork created, changing:
to:
Comment #3
mkindred commentedComment #7
mandclu commentedThanks for identifying this, and for providing a fix. Merged in.