Spaceless Tag Issue

Created on 24 April 2024, 8 months ago
Updated 8 September 2024, 4 months ago

Problem/Motivation

After installing the Flag module (main module and the bookmark module) and assigning it to a content type. I'll choose the "display link as field" option under the bookmark settings. Unfortunately, if I try to navigate to a page of the chosen content type, I get the following error:

Twig\Error\SyntaxError: Unknown "spaceless" tag. in Twig\Parser->subparse() (line 17 of themes/custom/uswds_base_3x_nicic/templates/modules/flag/flag--bookmark.html.twig).
Twig\Parser->parse() (Line: 490)
Twig\Environment->parse() (Line: 518)
Twig\Environment->compileSource() (Line: 131)
Drupal\Core\Template\TwigEnvironment->compileSource() (Line: 350)
Twig\Environment->loadTemplate() (Line: 312)
Twig\Environment->load() (Line: 39)
twig_render_template() (Line: 348)
Drupal\Core\Theme\ThemeManager->render() (Line: 480)
Drupal\Core\Render\Renderer->doRender() (Line: 240)
Drupal\Core\Render\Renderer->render() (Line: 165)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 166)
Drupal\Core\Render\Renderer->renderPlain() (Line: 183)
Drupal\Core\Render\Renderer->doRenderPlaceholder() (Line: 712)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}()
Fiber->start() (Line: 720)
Drupal\Core\Render\Renderer->replacePlaceholders() (Line: 597)
Drupal\Core\Render\Renderer->doRender() (Line: 240)
Drupal\Core\Render\Renderer->render() (Line: 153)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 154)
Drupal\Core\Render\Renderer->renderRoot() (Line: 286)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->renderPlaceholders() (Line: 135)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments() (Line: 45)
Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 214)
Symfony\Component\HttpKernel\HttpKernel->filterResponse() (Line: 202)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

1. Install Flag Module and Flag Bookmark Module
2. Edit settings on Bookmark content type to include a content type and set the display options to "Display link as field".
3. Attempt to view a page of that content type

πŸ’¬ Support request
Status

Fixed

Component

Flag Bookmark

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    Twig\Error\SyntaxError: Unknown "spaceless" tag. in Twig\Parser->subparse() (line 17 of themes/custom/uswds_base_3x_nicic/templates/modules/flag/flag--bookmark.html.twig).
    This error is saying there's a problem with the custom theme you are using on your site - namely the file themes/custom/uswds_base_3x_nicic/templates/modules/flag/flag--bookmark.html.twig

    It is important to note that this file is NOT provided by the Flag module, so there is nothing we can do here in the Flag module to fix the problem for you. Evidently the custom theme was developed with an older version of Twig where the 'spaceless' tag was still available. That tag was deprecated and is no longer available in current versions of Drupal core.

    The fix for your custom theme is probably as simple as replacing:
    {% spaceless %}
    with:
    {% apply spaceless %}
    in that theme file.

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland
  • Status changed to Fixed 4 months ago
  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024