Drupal 8 cache preprocessing. Drupal 8 cache is hard!

Drupal - Open Source Content Platform - Tue, 01/15/2019 - 18:06

I have a component that needs to get the current time that I am preprocessing in hook_preporcess_page. I am setting my variable as $variables['current_time'] = $current_time;.

In page.html.twig I am rendering the variable as {{ current_time}}. This works great with cache disabled in development mode but when live the {{ current_time }} HTML markup is cached. I Still want to take advantage of all the cache settings in Drupal I just want it disabled for this one variable in the twig markup.


submitted by /u/and_Dez
[link] [comments]

Need help organizing content/taxonomy

Drupal - Open Source Content Platform - Tue, 01/15/2019 - 16:01

Hi, I'm quite new to Drupal, and I've managed to get Pathauto working for pretty URLs, but I am running into a few issues organizing and displaying content.

First off, it looks like Breadcrumbs aren't working (possibly from Pathauto). Every article I post just has a link to the home page and nothing more. I noticed that there is an "easy_breadcrumbs" module, but that would not display the breadcrumbs properly because of how I laid things out...

To organize content, I decided to have a hierarchy of tags. This might be wrong, but at Home> Administration> Structure> Taxonomy> Edit Tags, I have a multilevel hierarchy of tags.

I was never able to figure out how to get nodes to appear nicely using my tag hierarchy with Pathauto, so I just used the pattern "article/[node:created:html_year]/[node:title]" which I guess I settled for.

The Pathauto URL pattern for taxonomy was much easier: "[term:parent:url:path]/[term:name]" and looks really good, something like example.com/health-articles/exercise

Is making a hierarchy of tags the right way to do Drupal taxonomy? What would be the best way to get Pathauto and breadcrumbs working the way I want?


submitted by /u/JerkySandwich
[link] [comments]

How to use simple test to look for general PHP failures?

Drupal - Open Source Content Platform - Tue, 01/15/2019 - 14:43

I have a custom module that will throw PHP strict notices when it is first enabled. I had assumed that running setUp(), or any Assert, would also ensure that no PHP notices, errors, or warnings. I have testing script with a setUp() function, but no actual tests. The script currently passes despite the notices. Do i need to add a test to assert the the text “PHP Notice” ( or something) does not appear on the page after enabling the module?

submitted by /u/TheRealBeakerboy
[link] [comments]

Blocked out of Drupal account can I prove by whom?

Drupal - Open Source Content Platform - Tue, 01/15/2019 - 13:07

So, I'm 99% sure the asshat developer has blocked my account. When I try to log in I get the message "The username XXX XXX has not been activated or is blocked."

I've tested my account on three of the sites we manage and I get the same message on all of them. I've tested the Test User account and on all sites I can log in with that account fine.

I've effectively been blocked from doing my job and my line manager isn't taking charge of the situation.

I'm expecting the answer to be no but does anyone know if it is possible to track who has blocked an account or why an account has become blocked? I know he will argue he didn't do it and there is an issue with the site which is why I can't log in but given that I can log in as the Test User I'm calling bullshit on that. He is a contractor so i'm hoping if I can gather enough evidence I could get him sacked.

submitted by /u/jinkx725
[link] [comments]

Need help adding more content to a view.

Drupal - Open Source Content Platform - Tue, 01/15/2019 - 11:55

Hey guys, I am back, mainly because this has been the best resource to find solutions to my issue. (big thank you!) So i just started this new job, and their website is operated by Drupal 7. I am new to drupal, and i'm limiting myself on experimenting because i am afraid that ill delete something that is already existing.

Anyways, i am working for a company that has a pretty big site, and they need me to add onto their accordion tab, they need more content. When i hit the little gear on the block I go to "edit view", i scroll down and see the content. What i am trying to do is edit the content so that I can add another tab on the accordion. Is there anyway to do this? or do i need to create a brand new 'node', or a new 'view'?

How can I add content on the bottom? i created this myself for testing purposes, but I want to add content to an existing block/window.

here are some screenshots to see if i am making any sense.

thank you in advance!

submitted by /u/mxcomtj
[link] [comments]

Help for a database error!

Drupal - Open Source Content Platform - Tue, 01/15/2019 - 11:23


I have been getting this same error to error_log on few of my sites. Anyone know what may cause this and how to fix it?

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 1813 Tablespace for table '"database_name"."cache_config"' exists. Please DISCARD the tablespace before IMPORT.: CREATE TABLE {cache_config}

It causes webforms and login page after some time to display the error page: "The website encountered an unexpected error. Please try again later."

I can login and fix it by downloading the site and database to my XAMPP install and there I can login. After clearing caches everything works for a while again. Then after some time the same error appears again.

Thank you for your help!

submitted by /u/Crystii
[link] [comments]

Does Drupal offer a way to export the managed fields layout?

Drupal - Open Source Content Platform - Tue, 01/15/2019 - 09:12

The Manage display page for content types enables the export of the fields layout.

Is there something similar for the Manage fields page, the page which creates the layout for the node edit form?

submitted by /u/vfclists
[link] [comments]

It's Triumphant Tuesday! Post your recent Drupal wins and launches

Drupal - Open Source Content Platform - Tue, 01/15/2019 - 09:06

Here's your chance to brag about cool stuff you've done recently and awesome sites you've shipped. Anything happy and Drupal-related goes.

(Check out the weekly post schedule in the sidebar)

submitted by /u/AutoModerator
[link] [comments]

From 0 to 100 in drupificial intelligence

Drupal - Open Source Content Platform - Tue, 01/15/2019 - 01:17

This is the title of the presentation I proposed at drupal mountain camp DAVOS.
If you have interesting questions/use-cases you want to see explained. Send them to me. I'll see what I can do. https://drupalmountaincamp.ch/sessions/0-100-drupificial-intelligence

submitted by /u/woutersfr
[link] [comments]

Thumbnails not created for specific image file extensions

Drupal - Open Source Content Platform - Mon, 01/14/2019 - 22:19

Hi guys,

I'm a noob with Drupal admittedly. I've spent days on this and have looked at all .htaccess files, theme settings, yml code, and I cannot find where this issue would originate. The Drupal stackexchange community has only provided me with a downvote.

Link/summary: https://drupal.stackexchange.com/questions/272510/thumbnails-not-created-for-specific-image-file-extensions-case-sensitive

Hoping I can find at least one pointer/suggestion for where to look on here as I always have more luck with Reddit. Thank you.

Edit: (running Drupal 8.6.3)

submitted by /u/montag64
[link] [comments]

Suggestions for data input format—Static Charts and Graphs

Drupal - Open Source Content Platform - Mon, 01/14/2019 - 21:59

I’ve had static charts and graphs on my to-do list for the Flot module for quite some time, and I’ve made good progress so far today. My plan is to have a block that can be configured to display static scatter plots, bar chars, or pie charts.

Does anyone have any suggestions on the best way for a user to enter data into the block config UI? I currently have it set up where they would enter a set JSON arrays in a textarea. Each new line in the textarea is a new series. Does anyone have a better idea?

submitted by /u/TheRealBeakerboy
[link] [comments]

Continuous integration with Drupal 8 and Gitlab CI/CD

Drupal - Open Source Content Platform - Mon, 01/14/2019 - 21:17

If you want to make your deploy process easier, my advice is to start using a continuous delivery approach in your project.


submitted by /u/ADCI_Solutions
[link] [comments]

Editor with collaboration features

Drupal - Open Source Content Platform - Mon, 01/14/2019 - 15:25

Hello, I am searching for a way to import collaboration tools into Drupal 8 and more specifically on the Ckeditor. The built in ckeditor 4 (which is embedded on D8) doesn't have those features but the new ckeditor 5. Any idea how can I add ckeditor 5 to Drupal or any similar tools?

submitted by /u/VagelisC
[link] [comments]

Can I do this with Drupal 8 (Presentation Manager) ?

Drupal - Open Source Content Platform - Mon, 01/14/2019 - 14:54
My project's structure:

I'm building a Presentation Manager.

  • A Presentation has a title, an image and Slides
  • A Slide has a type (can either be text, image or video)
  • We want to be able to re-order slides inside a presentation
What I've been able to build so far:

I've created a Presentation and a Slide content types. I've given an Entity Reference to the Slide content type, allowing me to link a Slide to a Presentation.

I think this is enough in terms of structure. I have created a view to list all Slides that are assigned to a specific Presentation using Url Params.

So far so good, the only thing is that this is for a client and the UI for managing Slides in a Presentation isn't very user friendly.

What I would like ideally:
  • Presentations-list page: Display a list of all presentations
  • Presentation-edit page: Display the form for editing a presentation details (title, image, and a list of slides). Ideally each slide should have a little drag-handle allowing us to re-order them on that screen. Also we want a button to add a new Slide into this Presentation.
  • Slide-edit page: Display the form for editing a specific slide. Change the text, the image, or the video. Delete the slide.
  • Slide-add page: Display the form for adding a new slide inside a Presentation. Maybe there's a way to pre-fill the Presentation Entity Reference using url Params?

Any Idea how I can achieve this in Drupal?

Thanks in advance.

submitted by /u/monsieurninja
[link] [comments]

Weekly Drupal beginner questions thread

Drupal - Open Source Content Platform - Mon, 01/14/2019 - 09:07

Ask your newbie questions here! No judgement!

(Check out the weekly post schedule in the sidebar)

submitted by /u/AutoModerator
[link] [comments]

Help Updating from PHP 5.6.39 to PHP 7. Am using drupal8.

Drupal - Open Source Content Platform - Mon, 01/14/2019 - 06:30

I have been googling and googling and googling for the better half of the day to find a way to use PHP 7 on my drupal. I havent found a way... Please help. Am using drupal 8.6.5. I realised it was a problem when i kept getting 'unsupported declare strict type' error log and the site crushing everytime... I need direction on the process of how to do the update...i will appreciate it alot. thank you.

submitted by /u/BudaBoss
[link] [comments]

Help, Calendar & paragraph

Drupal - Open Source Content Platform - Sun, 01/13/2019 - 12:11


I'm using Drupal 8 and paragraphs. I've got different paragraphs such as "training session", "meeting", "competition", etc. Each of these paragraphs have a date field + a taxonomy field + others fields. These paragraph can be added to different content type (announcements, results ). I would like to display a calendar with all the date contained in these paragraph. More precisely I would like to display in the calendar, the title of the node that contains one of these paragraph at the corresponding date.

I found two possible modules : calendar and "full calendar view". I tried both of them with with a single paragraph (eg "training session"). I build a view, if I display the data as HTML then I can see all the paragraphs, so I believe the view setting is not that bad. As soon as I switch to "calendar" or "full calendar view", despite trying different settings, I never succeed in displaying the data.

The issue is clearly related to paragraph : if I try to display a calendar configured to display a classical content type, then it works...

Question: does anybody has already solved a similar issue? any help will be greatly appreciated

submitted by /u/seb59
[link] [comments]

What are people using for CAPTCHA these days?

Drupal - Open Source Content Platform - Sat, 01/12/2019 - 12:47

I've been using the CAPTCHA module for Drupal 8, configured with high security, and yet the spam still keeps flowing through. Usually in Cyrillic.

Is there a configuration guide or site tester that could be used to make things better? Are there alternative's to Google's CAPTCHA that work better?

submitted by /u/TrevorBradley
[link] [comments]