Questions tagged [8]

Version tags should be used only for questions that apply to a version only, not to merely say what version a site is using.

Filter by
Sorted by
Tagged with
0
votes
0answers
3 views

How to show date as “XX ago” in comments/node/taxonomy/blocks?

This code works for comments but I need to display the date in two digits (XX minutes, XX hours, X year) not as "XX hours XX minutes" for example. And I need to apply this format for the rest of the ...
-1
votes
0answers
17 views

Show different item each render [on hold]

I have a Drupal 8 view that has several items in it, but I've configured it to show just one. What I want to do now is to iterate through the items on each page render, so each item get's equal ...
0
votes
0answers
4 views

Overriding the User entity list_builder handler

I'm trying to override the User entity list_builder handler to add another column to the table and implement some JavaScript search functionality. The code I'm using is below which is in my modules ...
0
votes
1answer
18 views

Why ajax button calls submitForm?

I have no problems with using Ajax in every form element other then button. When I'm clicking this button '#type' => 'submit', '#ajax' => [ 'callback' => '::ajax_function', '...
0
votes
2answers
15 views

Cloning nodes between multisite instances with separate databases

I'm working on a Drupal 8.6 multisite and my client wants to be able to duplicate content between many of these sites. The codebase of the websites is the same, but each of them uses a different ...
0
votes
1answer
13 views

Difficulty with checkbox boolean feature

Our stakeholders asked for a feature where they can "pin" blog posts (basically the "sticky" feature, but I'll use the term "pin" and "pinned" in this question), where certain posts that they select ...
-3
votes
0answers
19 views

How does accessibility compliance in Backdrop CMS compare with that of Drupal 8? [on hold]

One of the benefits of Drupal 8 was to enhance compliance with Section 508 accessibility requirements. To what extent does Backdrop match Drupal 8 regarding those improvements? Do those ...
0
votes
0answers
13 views

How to change where the sqlite database is generated when running tests?

When running tests, I have some .sqlite files and tmp files created in my project root while the test is running. This causes my IDE to go crazy. Is there a way to tell Drupal in phpunit.xml to store ...
0
votes
1answer
17 views

UTF-8 encoding when creating nodes (from mails)

I'm making a customized version of the Mailhandler module, which has a node creation function: protected function createNode(MimeMessageInterface $message, DefaultAnalyzerResult $result) { $node =...
-2
votes
0answers
26 views

Calendar/datepicker popup not working on safari

$form['date']['air_date'] = array ( '#type' => 'date', '#title' => t('Air Date:'), '#required' => TRUE, '#default_value' => !empty($arr['air_date']) ? $arr['air_date'] : '', ); ...
0
votes
1answer
35 views

Show rendered node in jQuery modal through JSON

Whenever a link has a specific class I want to show it as a jQuery modal. I have added the neccesarry data attributes to the link in order to be able to use it as a modal. I have also created a route ...
0
votes
0answers
11 views

Views exposed date filter range format

I have a view with an exposed filter for a date range. I use jquery ui datepicker to select dates. It works good and I can select dates in spanish format (dd/mm/yyyy). But when I apply the filter, It ...
-2
votes
1answer
41 views

How can I change the taxonomy term title?

Simple as that. I want to change the H1 tag from taxonomy views to something like "Articles from %term" to make it more user friendly and not redundant (breadcrumbs shows the term alone). I couldn't ...
0
votes
0answers
20 views

Can't Install search_api_solr and search_api

I'm trying to install search-api-solr and search-api. I try first using composer and when I check composer.json they listed in the file. but drupal installation page not affected so I end to install ...
-2
votes
0answers
15 views

Anyone have examples of using Drupal 8 and selling nodes (Ads in this case) with e-commerce? [on hold]

I'd like to be able to allow customers to purchase ad space on our website, upload an image, and after review by the administrator, allow it to be published. I've done something close to this in ...
0
votes
1answer
19 views

How to pass variables to template to use it in email?

I've written a "hook_mail()" to send html emails. I have everything but I would like to use a custom template. I use a "hook_theme" as well, but my question is how can I pass variables to use it in my ...
0
votes
1answer
34 views

Alter existing route's output formats?

I want to alter the entity.node.canonical route so that when it is accessed using ?_format=json it will return the rendered node in JSON. So far I have created a RouteSubscriber that alters the route ...
0
votes
0answers
19 views

How to reference webform field option?

So I have webform module installed and I created a webform. Webform has an choice field (drop-down). Let's say you can select one of 3 options: "one", "two", "three". I need a way to add (editable) ...
-1
votes
0answers
16 views

How can I add a sitewide proxy to the HTTP client service?

On a particular environment, all the external requests via Drupal's HTTP client (http_client service) should go through the proxy. However, there is no option to set proxy details on each environment ...
0
votes
0answers
19 views

How can I override the form-element-label.html.twig template?

In a view, I have checkboxes displayed using the better-exposed filter. Ajax setting is true. Currently, there is no template suggestion for overriding form-element-label.html.twig. Somehow by adding ...
0
votes
0answers
44 views

Page title not being rendered after page refresh (possible cache issue)

This is the problem at hand: the first time I access a page after a cache rebuild, the title of said page is displayed correctly. But when I refresh (or access it later after navigating other pages) ...
0
votes
0answers
20 views

How to get the values of web form remote post handler?

i have created a web form handler ie. Remote post Handler. and i have gave one URL for posting the submitted data. How to access those submitted values in that particular page. How to GET ...
0
votes
0answers
23 views

Import a node with paragraphs [on hold]

I would like to import node with multiple paragraphs, but I can't make the Feeds module work with paragraphs. This is a sample of XML data that needs to be uploaded. <test-feed> <...
0
votes
0answers
35 views

Caching user profile image? [duplicate]

If I log in as User 1, i see user 1's profile picture. If I log in as User 2, I see user 2's profile picture. As expected. But after browsing a bit, User 2 would suddenly see User 1's profile picture. ...
3
votes
0answers
44 views

How to achieve layout nesting in layout builder?

We have a content type (Page) and a vocabulary (Sections). The content type has a reference field to the vocabulary, and the vocabulary has a reference to a menu. Also, we are interested in being able ...
2
votes
1answer
22 views

Migrating csv data as array into multi-field

How do I migrate a sequence of data into a multi-value field? I am learning D8 migration and working on a large CSV of historic census data from around the world. Example below: id,Country Name,...
0
votes
0answers
18 views

jsDelivr CDN provider does not work using bootstrap for drupal [on hold]

So I'm trying to create a drupal theme with bootstrap. However my boostrap does not get loaded due to malfunctions of jsDelivr (I think). PS: Does anyone know some good Drupal guides/books? Because I ...
0
votes
0answers
35 views

How to remove or fix Missing bundle entity that causes error

Working on a new site, and I have a "regions" taxonomy vocabulary that has mysteriously disappeared, even though it shows in the list of taxonomies. If I try to view, edit or delete the taxonomy by ...
1
vote
1answer
48 views

How to write test(s) with specific config to test custom access checks?

I have built a custom module that alters some of the User routes (view, edit, delete) to do 3 things: Forbid account editing, except a user who has 'administer users' permission Forbid account ...
0
votes
0answers
18 views

Follow symlinks inside of default/files

I am running Drupal 8.7.6. The default/files directory is a symlinked to a read only mount (/mnt/files_ro). Drupal needs to write inside a few folders as it aggregates and caches assets, so I created ...
0
votes
2answers
37 views

Duplicate content between multi-sites

I'm working on a feature of a Drupal 8 multisite with separated databases for each site trying to implement the following requisite. When posting news to the main site (all the other sites are ...
1
vote
0answers
23 views

Change field type for custom entity (from integer to decimal) with existing data

Yes I have seen previous answers about that, but I'm looking for an new answer : That does not use SQL request That does not use deprecated function like db_change_field() maybe that uses the new ...
2
votes
0answers
56 views

Does the structure of the module's src folder matter? [on hold]

I've read about the Basic Structure guide to building a Drupal 8 module. It's great that it outlines the basic files needed to get a module up and running. Where it falls short is the contents of the ...
0
votes
0answers
21 views

How can I add fields to a custom content type

I am using the following code to set create a field programmtically and I am trying to set the cardinality as unlimited. But I am getting the error and I cannot add any values. Symfony\Component\...
4
votes
1answer
105 views

How can I have a custom module checked for deprecated functions?

I created a custom module in Drupal 8 for a specific purpose. How can I find out if it contains any deprecated functions?
-2
votes
0answers
28 views

How do I create a menu item from view results [on hold]

My organization has several Departments. Some of these Departments have websites. Some do not. I have a Department Content Type. These Departments have an optional website field. I have a view that ...
0
votes
1answer
37 views

How to Give abilty to filter content by geography, separate from language?

I'm not sure if this is feasible, or how to go about it. I want a dropdown (and use IP detection) to provide users with content based on Region - Not Language. Because we will Also be using the normal ...
1
vote
0answers
34 views

Can I alter the behaviour of a core function?

To make content management easier, for a large website we have allowed the content administrators to put a pipe in the title of a piece of content. Anything before the pipe is ignored. Is there a way ...
0
votes
1answer
23 views

How to update route cache when saving an entity?

I have added a custom access check to the /user/{user} route: class RouteSubscriber extends RouteSubscriberBase { /** * {@inheritdoc} */ protected function alterRoutes(RouteCollection $...
0
votes
1answer
28 views

Removing entity queue entries from a view

I have a list of 100 projects. I have set 10 projects as featured projects using Entity Queue module. I have a projects page that shows has two views: First view: 10 projects from entity queue ...
0
votes
0answers
12 views

Can't add sub tab local tasks to admin/content/my_entity

I have a custom content entity list which has its own tab into admin/content/my_entity. The content of this tab is generated by using EntityListBuilder class. Actually, I created it with the drupal ...
0
votes
1answer
38 views

How to discover the currently active twig template

I need to find out the currently active Twig template from within my module preprocess function. function mymodule_preprocess_field(&$variables, $hook) { // How do i retrieve the currently ...
0
votes
2answers
41 views

AJAX Views with filter as path component

I have a view of Commerce products of type Print. The product type Print has a reference on a Taxonomy called Category. I setup the Category field as an exposed filter (dropdown) for my View page. The ...
-4
votes
0answers
38 views

Best solution for a multi column mega menu in combination with bootstrap 4 [closed]

I am using Bootstrap 4 (not the Bootstrap theme but a custom setup) for my custom Drupal 8 theme. I have a Main menu with taxonomy categories and links. I need to divide those categories and it's (...
0
votes
1answer
28 views

Missing checkbox in Webforms settings

I ran the following command: $ composer require 'drupal/webform:5.4-beta1' Some of the components in the Extend section show updated version, while Webform (top one) still says 5.0-rc12. My ...
-2
votes
0answers
87 views

After migration website would not load for anonymous users

we have a drupal 8.7.6 that perfectly works fine when logged in as admin - all pages, functionalities work fine with good performance. When I tried to load the website as anonymous user - it keeps on ...
0
votes
0answers
26 views

Prepopulating composite webform field from data passed by POST

I need to POST a JSON to a URL with a webform on it and have the WebformHandler. This is the alterForm of my WebformHandlerBase subclass public function alterForm(array &$form, ...
0
votes
1answer
22 views

How to remove tags from display in form?

I have this form tempate <div class="a"> {{ form.card.a }} </div> <div class="a"> {{ form.card.b }} </div> and I want to to frame it with tag like this. <a href="...
0
votes
0answers
30 views

Class Dompdf() not found in custom module

inside a custom module (custom form), I need to call the Dompdf() class. Here is my code: use Dompdf; // or use Dompdf\Dompdf; ...... class myclass.... public function buildPdf(array &$form, ...
1
vote
2answers
26 views

Default value for datetime field definition in content entity?

I have the following datetime field definition for my content entity: $fields['start_date'] = BaseFieldDefinition::create('datetime') ->setLabel(t('Start date')) ->setDescription(t('Start ...