Apply patches with Composer


Now and then you come to modules that are just not doing what you want from them, unless you apply a patch.

At this time there is a patch for the Full Calendar View module. A calendar where you can add interactive content by double clicking on a day in the calendar. This works nicely as an administrator, but if you give rights to anonymous or authenticated users to do the same, then it goes wrong.

The patch is available at:

and it looks like this. Now you can make the right adjustments (+ is add - is removing) in the two files, but this is rather difficult, and it is still a simple patch ...

diff --git a/ b/
index 9a05838..6fc4cf6 100644
--- a/
+++ b/
@@ -48,7 +48,7 @@ function template_preprocess_views_view_fullcalendar(array &$variables) {

   // Can the user add a new event?
   $dbl_click_to_create = FALSE;
-  if (!empty($user) && $user->hasPermission("create $event_bundle_type " . $entity_type->getLabel())) {
+  if (!empty($user) && $user->hasPermission(strtolower("create $event_bundle_type " . $entity_type->getLabel()))) {
     $dbl_click_to_create = TRUE;
   // Pass entity type to twig template.
diff --git a/src/Controller/CalendarEventController.php b/src/Controller/CalendarEventController.php
index d2ec43e..141f3b3 100644
--- a/src/Controller/CalendarEventController.php
+++ b/src/Controller/CalendarEventController.php
@@ -202,10 +202,11 @@ class CalendarEventController extends ControllerBase {
     $end_field = $request->get('end_field', '');
     $form = [];

-    if (!empty($type)) {
+    if (!empty($type) && !empty($entity_id)) {
+      $entity_label = $this->entityTypeManager()->getDefinition($entity_id)->getLabel();
       $user = $this->currentUser();
       // Check the user permission.
-      if (!empty($user) && $user->hasPermission("create $type " . $entity_id)) {
+      if (!empty($user) && $user->hasPermission(strtolower("create $type " . $entity_label))) {
         $data = [
           'type' => $type,

To do this with Composer, you need to add two things in composer.json file.

First you need at the requirement section: "cweagans / composer patches'" ~ 1.0 ". You also need to end the previous line with an comma!


Then you have to add some script in the extra section. Note that this is the URL of the patch from proceded by a section of text that you choose. You should also end the previous line with a comma.


The module you need to install Composer. With composer update , run to check for patches.


This method is preferable to the git method as updates of the module, apply the patches automatically. Otherwise, you must perform every time. 

Source: with the necessary modifications to make it work effectively.