any attempt to display a content with a date field with "add to cal" format trigger the

"The website encountered an unexpected error. Please try again later."

Please advise, this module looks exactly to what i was looking for.

thank you in advance
thierry

Pantheon is proud to support Drupal and open source Pantheon logo

Comments

wxactly's picture

Hi @geufroi - what is the field type of your field (date, datetime, daterange, etc)? Could you please paste the error log output from /admin/reports/dblog?

geufroi's picture

hi @wxactly,
thanks for willing to help me on this.
basically I juste created a content type with a "date" field type.
then I specified it's a date&time one.
and I apply "add to cal" for the format.
whenever i want to display a record of such content type I get the white page with the warning.
...
by the way here is the log output
Error : Class 'Spatie\CalendarLinks\Link' not found dans Drupal\addtocal\Plugin\Field\FieldFormatter\AddtocalView->viewElements() (/Applications/MAMP/htdocs/drupal/modules/addtocal/src/Plugin/Field/FieldFormatter/AddtocalView.php ligne 212)
#0 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/Field/FormatterBase.php(89): Drupal\addtocal\Plugin\Field\FieldFormatter\AddtocalView->viewElements(Object(Drupal\datetime\Plugin\Field\FieldType\DateTimeFieldItemList), 'fr')
#1 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(263): Drupal\Core\Field\FormatterBase->view(Object(Drupal\datetime\Plugin\Field\FieldType\DateTimeFieldItemList), 'fr')
#2 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(340): Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array)
#3 /Applications/MAMP/htdocs/drupal/core/modules/node/src/NodeViewBuilder.php(24): Drupal\Core\Entity\EntityViewBuilder->buildComponents(Array, Array, Array, 'full')
#4 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(282): Drupal\node\NodeViewBuilder->buildComponents(Array, Array, Array, 'full')
#5 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(239): Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array)
#6 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build(Array)
#7 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array(Array, Array)
#8 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/Render/Renderer.php(781): Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'exception', 'Drupal\\Core\\Ren...')
#9 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/Render/Renderer.php(372): Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array)
#10 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/Render/Renderer.php(200): Drupal\Core\Render\Renderer->doRender(Array, false)
#11 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(241): Drupal\Core\Render\Renderer->render(Array, false)
#12 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#13 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(242): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#14 /Applications/MAMP/htdocs/drupal/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))
#15 /Applications/MAMP/htdocs/drupal/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))
#16 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#17 /Applications/MAMP/htdocs/drupal/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))
#18 /Applications/MAMP/htdocs/drupal/vendor/symfony/http-kernel/HttpKernel.php(163): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view')
#19 /Applications/MAMP/htdocs/drupal/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#20 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /Applications/MAMP/htdocs/drupal/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /Applications/MAMP/htdocs/drupal/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /Applications/MAMP/htdocs/drupal/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /Applications/MAMP/htdocs/drupal/core/lib/Drupal/Core/DrupalKernel.php(706): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /Applications/MAMP/htdocs/drupal/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#29 {main}

geufroi's picture

Indeed, I installed everything manually.
your post is rising hope !
In fact i had also an issue with the regular module calendar which led to thje same error as well. May be this is the same issue.
I will try with composer.
THANK YOU VERY MUCH
thierry

geufroi's picture

hi, i am a complete newbie with composer.
I did manage to install a regular drupal with composer.
when i run the following command
composer require 'drupal/addtocal:2.x-dev@dev'
I get this error message

[InvalidArgumentException]
Could not find a matching version of package drupal/addtocal. Check the pac
kage spelling, your version constraint and that the package is available in
a stability which matches your minimum-stability (stable).

what did I do wrong ? thanks ;-)

wxactly's picture

Sounds like minimum-stability: stable is set in your composer.json file. You'll need to set it to dev to install dev branches, or setting it to beta should allow you to install the beta version of this module (composer require drupal/addtocal:^2.0@beta).

Composer docs here: https://getcomposer.org/doc/04-schema.md#minimum-stability

We will be releasing a stable 2.0 version at some point, but hopefully this helps unblock in the meantime :)

aritrika.d's picture

geufroi's picture

hi there,
I indeed managed to use composer properly on my local machine and install addtocal 8.x-1.1
I faced both difficulties for me to use properly composer and having issue with dev or beta version not installing.
I am not knowledgable enough to experiment with patches.
Thanks to @wxactly and @aritrika.d for reacting to my post.

mmjvb's picture

Actually, it is none of the above!

                docker@cli:/var/www$ composer require drupal/addtocal 2.x-dev ./composer.json has been updated Running composer update drupal/addtocal Loading composer repositories with package information Updating dependencies Lock file operations: 2 installs, 0 updates, 0 removals   - Locking drupal/addtocal (dev-2.x cdabeed)   - Locking spatie/calendar-links (1.4.2) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 2 installs, 0 updates, 0 removals   - Syncing drupal/addtocal (dev-2.x cdabeed) into cache   - Installing spatie/calendar-links (1.4.2): Extracting archive   - Installing drupal/addtocal (dev-2.x cdabeed): Cloning cdabeed4d2 from cache Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead. Generating autoload files 28 packages you are using are looking for funding. Use the `composer fund` command to find out more! docker@cli:/var/www$              

The version constraint used is invalid. You don't mix branch with stability. When using a branch the minimum stability is not relevant. minimum stability is only considered when using a proper constraint. Using stability in your constraint overrides minimum stability for your site. No patch needed as the minimum stability in root is the only one considered.
examples:
2.x-dev To get that particular branch
^2@dev To get the most recent release above 2, currently 2.0.0-beta3
^2 To get the most recent release above 2 respecting minimum stability for your site

Although there is not need for minimum stability in the module itself, it is not relevant to this support request. No bug report for this module!
Also recommend to use the proper syntax, rather than the developer shortcut (package:version). The proper syntax has a separate version constraint. The shortcut is not recognized everywhere, resulting in the error message when not valid.

wxactly's picture

Status: Needs review » Closed (works as designed)

Thanks @mmjvb - yeah, this ticket has gone off the rails a bit. The patch above doesn't do anything to address the original problem, and it sounds like @geufroi was able to get a stable version of this module working.

coaston's picture

Hi all,

is it possible to install calendar-links via Ludviq ? I cannot use composer on my prod site.

mmjvb's picture

@coaston Assuming you mean Ludwig, it can be used to install any module. It just requires to have an ludwig.json, which you can provide yourself. Suggest to create a support issue for that project requesting a ludwig.json, providing the one you created.

coaston's picture

@mmjvb thank you, will do so.

Just can you tell me the folder name where the lib should be downladed? Like /lib/calendar-lists/... but this one does not work.

Greg Boggs's picture

You don't need to install composer in production. You only need to install composer on your own computer.

1. Copy your website files to your computer
2. Install composer (If you're on windows there's a downloadable installer)
3. Run composer require drupal/addtocal
4. Copy all the files back to your web hosting

mmjvb's picture

Again, suggest to create an issue in the project you are talking about. Doesn't sound related to this issue! Put a link to that issue here.

Maybe then it is possible to answer the question you have, currently it doesn't make sense as you did not provide the needed details. You need to put your question in the correct context, otherwise it is anybodies guess.

coaston's picture

Yes this one, i got the same error message. But tnx to @devad it has been resolved. Perfect plugin!

mmjvb's picture

You already found the answer to your question, but for others: modules/[module]/lib/[package]/[version]
where package is [provider]-[library]
[module]: addtocal
[provider]: spatie
[library]: calendar-links
[version]: v1.5.0

.../modules/addtocal/lib/spatie-calendar-links/v1.5.0