Calender link werkt niet

Ik werk aan een website voor een duikclub. Daarop heb ik een kalender gemaakt met "Full Calendar View Plugin module" voor verschillende activiteiten. Deze werkt prima. Nu komt er vaak de vraag om de activiteiten te kunnen overzetten in de leden hun persoonlijke agenda vb een google agenda, of iphone,...
Ik probeer dit te doen door gebruik te maken van volgende module:
calendar_link

Ik heb de nodige fields aangemaakt in een inhoudstype: activiteit.
Deze inhoudstype heeft een eigen template waarin ik het volgende heb toegevoegd:

{% set links = calendar_links(node.title, node.field_start, node.field_end, node.field_location) %}

Als ik mijn cache leeg en de pagina vernieuw krijg ik een error. In mijn log zie ik dan volgende fout:

Warning: Undefined array key 2 in freelancer_zymphonies_theme_preprocess_page() (regel 132 van /customers/3/7/6/fun-divers.be/httpd.www/themes/freelancer_zymphonies_theme/freelancer_zymphonies_theme.theme)
#0 /customers/3/7/6/fun-divers.be/httpd.www/core/includes/bootstrap.inc(347): _drupal_error_handler_real(2, 'Undefined array...', '/customers/3/7/...', 132)
#1 /customers/3/7/6/fun-divers.be/httpd.www/themes/freelancer_zymphonies_theme/freelancer_zymphonies_theme.theme(132): _drupal_error_handler(2, 'Undefined array...', '/customers/3/7/...', 132)
#2 [internal function]: freelancer_zymphonies_theme_preprocess_page(Array, 'page', Array)
#3 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Theme/ThemeManager.php(287): call_user_func_array('freelancer_zymp...', Array)
#4 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Render/Renderer.php(422): Drupal\Core\Theme\ThemeManager->render('page', Array)
#5 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Render/Renderer.php(201): Drupal\Core\Render\Renderer->doRender(Array, false)
#6 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Template/TwigExtension.php(479): Drupal\Core\Render\Renderer->render(Array)
#7 /customers/3/7/6/fun-divers.be/httpd.www/sites/default/files/php/twig/63e3d92ad970b_html.html.twig_FK0CCaYpYxhilJs4XJZhK-CdB/Ib-jtoJ7wGuAnL94vtRDCvR08WlQS-TmOT53O_IKHg8.php(84): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true)
#8 /customers/3/7/6/fun-divers.be/httpd.www/vendor/twig/twig/src/Template.php(405): __TwigTemplate_db993475b9e17e640ae78bfeee8a7de9->doDisplay(Array, Array)
#9 /customers/3/7/6/fun-divers.be/httpd.www/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#10 /customers/3/7/6/fun-divers.be/httpd.www/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#11 /customers/3/7/6/fun-divers.be/httpd.www/core/themes/engines/twig/twig.engine(55): Twig\Template->render(Array)
#12 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('themes/freelanc...', Array)
#13 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Render/Renderer.php(422): Drupal\Core\Theme\ThemeManager->render('html', Array)
#14 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Render/Renderer.php(201): Drupal\Core\Render\Renderer->doRender(Array, false)
#15 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(162): Drupal\Core\Render\Renderer->render(Array)
#16 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#17 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(163): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#18 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#19 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#20 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#21 /customers/3/7/6/fun-divers.be/httpd.www/vendor/symfony/http-kernel/HttpKernel.php(164): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view')
#22 /customers/3/7/6/fun-divers.be/httpd.www/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 2)
#23 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 2, true)
#24 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 2, true)
#25 /customers/3/7/6/fun-divers.be/httpd.www/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 2, true)
#26 /customers/3/7/6/fun-divers.be/httpd.www/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 2, true)
#27 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 2, true)
#28 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 2, true)
#29 /customers/3/7/6/fun-divers.be/httpd.www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 2, true)
#30 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php(166): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 2)
#31 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php(122): Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->makeSubrequest(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), '/system/404', 404)
#32 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/EventSubscriber/HttpExceptionSubscriberBase.php(109): Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->on404(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent))
#33 [internal function]: Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase->onException(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#34 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), 'kernel.exceptio...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#35 /customers/3/7/6/fun-divers.be/httpd.www/vendor/symfony/http-kernel/HttpKernel.php(219): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ExceptionEvent), 'kernel.exceptio...')
#36 /customers/3/7/6/fun-divers.be/httpd.www/vendor/symfony/http-kernel/HttpKernel.php(92): Symfony\Component\HttpKernel\HttpKernel->handleThrowable(Object(Symfony\Component\HttpKernel\Exception\NotFoundHttpException), Object(Symfony\Component\HttpFoundation\Request), 1)
#37 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#38 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#39 /customers/3/7/6/fun-divers.be/httpd.www/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#40 /customers/3/7/6/fun-divers.be/httpd.www/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#41 /customers/3/7/6/fun-divers.be/httpd.www/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#42 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#43 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#44 /customers/3/7/6/fun-divers.be/httpd.www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#45 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/DrupalKernel.php(709): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#46 /customers/3/7/6/fun-divers.be/httpd.www/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#47 {main}
.

Ik ken iets te weinig van deze materie om te begrijpen wat er fout gaat. Ik heb wel een bestand gevonden met de naam:freelancer_zymphonies_theme.theme Maar dit bestand kan ik niet openen op mijn computer.

Kan iemand mij helpen? Mag ook eventueel op een andere manier. Mijn doel is een geplande activiteit via een knop in iemands persoonlijke agenda zetten.

Alvast bedankt

BijlageGrootte
Plain text icon Mijn template, wel extensie .txt verwijderen4.69 KB
Drupalversie: 
9.x
Auteur: 
Steven Vandewalle
Door Steven Vandewalle op 8 februari, 2023 - 20:37

Heb mijn twig template aangepast naar dit:

{% set link = calendar_link('google',
node.title,
node.field_start,
node.field_end,
node.field_all_day,
node.body,
node.field_location
)
%}
Add to Google

Nu krijg ik duidelijk een php-error
Error: Class "Spatie\CalendarLinks\Link" not found in Drupal\calendar_link\Twig\CalendarLinkTwigExtension->calendarLink() (regel 79 van /customers/3/7/6/fun-divers.be/httpd.www/modules/calendar_link/src/Twig/CalendarLinkTwigExtension.php)
#0 /customers/3/7/6/fun-divers.be/httpd.www/sites/default/files/php/twig/63e3f855ec3b7_node--activiteit.html.twi__5H62ETvBdKotXN79GOH91548/R6DGAU4_Hob1uuCjCE0Cl2l4vzJ-3ElVTqcLjWjKy_w.php(124): Drupal\calendar_link\Twig\CalendarLinkTwigExtension->calendarLink('google', Object(Drupal\Core\Field\FieldItemList), Object(Drupal\datetime\Plugin\Field\FieldType\DateTimeFieldItemList), Object(Drupal\datetime\Plugin\Field\FieldType\DateTimeFieldItemList), NULL, Object(Drupal\Core\Field\FieldItemList), Object(Drupal\Core\Field\FieldItemList))
#1 /customers/3/7/6/fun-divers.be/httpd.www/vendor/twig/twig/src/Template.php(405): __TwigTemplate_8e4386362930beb72dea93a5d48f9435->doDisplay(Array, Array)
#2 /customers/3/7/6/fun-divers.be/httpd.www/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
#3 /customers/3/7/6/fun-divers.be/httpd.www/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
#4 /customers/3/7/6/fun-divers.be/httpd.www/core/themes/engines/twig/twig.engine(55): Twig\Template->render(Array)
#5 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('themes/freelanc...', Array)
#6 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Render/Renderer.php(422): Drupal\Core\Theme\ThemeManager->render('node', Array)
#7 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Render/Renderer.php(201): Drupal\Core\Render\Renderer->doRender(Array, false)
#8 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(241): Drupal\Core\Render\Renderer->render(Array, false)
#9 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Render/Renderer.php(564): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#10 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#11 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(132): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#12 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#13 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#14 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#15 /customers/3/7/6/fun-divers.be/httpd.www/vendor/symfony/http-kernel/HttpKernel.php(164): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view')
#16 /customers/3/7/6/fun-divers.be/httpd.www/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#17 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /customers/3/7/6/fun-divers.be/httpd.www/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /customers/3/7/6/fun-divers.be/httpd.www/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /customers/3/7/6/fun-divers.be/httpd.www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /customers/3/7/6/fun-divers.be/httpd.www/core/lib/Drupal/Core/DrupalKernel.php(709): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /customers/3/7/6/fun-divers.be/httpd.www/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#26 {main}

Ik vermoed dat ik nog iets ontbreek. Probleem is dat ik niet kan installeren via composer omdat ons domein dit volgens mij niet ondersteund. (one.com) Hoe kan ik Spatie\CalendarLinks\Link dan wel installeren?

afbeelding van belba
Door belba op 14 februari, 2023 - 04:40

De foutmelding heeft aan waar je moet zoeken. Spatie\CalendarLinks\Link" not found in Drupal\calendar_link\Twig\CalendarLinkTwigExtension->calendarLink(). Je hebt waarschijnlijk de externe library niet geinstalleerd : spatie/calendar-links

Succes, Jan

Door Steven Vandewalle op 14 februari, 2023 - 20:53

de library is enkel te installeren via composer. Ik heb via xampp een testsite lopen, ik heb hierop geprobeerd deze bibliotheek te installeren via composer. Wat al een grote uitdaging was. Ik snap maar weinig van die composer...
Ik vind nu in een mapje vendor de library spatie/calendar-links (Deze heb ik gevonden in mijn bestanden en stond niet in de installatie van xampp of drupal). Deze map heb ik gekopieerd en via mijn ftp geupload naar de site die draait op one.com in de zelfde map genaamd vendor. Dit bleef de zelfde fout aangeven. Nadien heb ik geprobeerd deze library te kopiëren naar de map modules en ook eens naar libraries, maar dat veranderde ook niks aan de foutmelding. In welke map zou ik deze dan moeten kopiëren?

Groeten Steven

Door Steven Vandewalle op 14 februari, 2023 - 21:06

Dit is de error: Warning: Undefined array key 2 in freelancer_zymphonies_theme_preprocess_page() (regel 132 van /customers/3/7/6/fun-divers.be/httpd.www/themes/freelancer_zymphonies_theme/freelancer_zymphonies_theme.theme)

Als ik in die file kijk op regel 132 zie ik dit staan:

//To get the current URL
$current_url = \Drupal::request()->getRequestUri();
// $current_path = explode("/", $current_url);
$current_path = parse_url($current_url);
$variables['current_path'] = $current_path[2];

Waarom zou dit iets te maken hebben met de module (calendar links) die ik probeer te laten werken?

Bookmark and Share

Drupal is een geregistreerd merk van Dries Buytaert. | Powered by Pantheon.

Drupal.be/Drupal.nl is de website van de Nederlandstalige Drupalgemeenschap.

onomatopee