Questions tagged [8]

Version tag to tag issues specifically related to Drupal 8.x. Please note that 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
1
vote
0answers
3 views

Drupal commerce: Inline entity form field alter

I am using Drupal Commerce. For the Variations, I am using multiple add /remove via AJAX. I need to make field readonly. 0 -> <input type="number" name="variations[form][inline_entity_form][...
0
votes
0answers
4 views

The provided host name is not valid for this server

I'm trying to migrate a drupal website from a server into my localhost but I trigger the error The provided host name is not valid for this server. I've seen I need to add the trusted host ...
0
votes
1answer
16 views

If statements in twig

I've got the following card in my drupal installation, I've hidden unnecessary items for my question in the picture. What I want to achieve is the following: I want the icon to change based on the ...
0
votes
2answers
16 views

Composer requirement

I have been installing/managing Drupal 8 sites without the use of Composer or Drush. Main reasons being that I'm not planning to have complex modules with dependencies and I'm comfortable to perform ...
0
votes
0answers
13 views

What are the steps involved in a drupal 8 page execution? [on hold]

I am looking for Drupal 8 execution order. So from settings.php to html rendering. The order in which scripts are called and executed. Is there an official page that shares this information?
0
votes
0answers
6 views

How to pull a record from Salesforce as well as push the new Drupal content ID back to Salesforce

I'm using the Salesforce Suite module. What I'm trying to accomplish: When a record is created in Salesforce, that record is pulled into Drupal and the new node content ID is pushed back to the ...
0
votes
0answers
11 views

How Update item on the second page in WebForm wizard

I am starting to work with webform in drupal 8 and I need to show values on the second page of the webform wizard, I have reviewed several solutions but I cannot do it. I tried using $ form_state-> ...
1
vote
0answers
29 views

How to run an executable from within a Drupal Controller?

I'm working on a controller that when called upon will take a screenshot of the main page of my site. I'm attempting this by calling Chrome in headless mode via the PHP shell_exec() function. $...
2
votes
2answers
33 views

How to tell if a field has renderable content before printing HTML around it?

I have a half dozen reference fields on a content type that sits at the bottom of a page under a heading of "Related" and some markup structure. I was checking if node.field_name is not empty, ... in ...
0
votes
0answers
14 views

How to use submenu as filter View?

I'm new in Drupal 8, and I want to use submenu as a filter in my page. Example: ParentChild child0 .child1 .child2 When I open the Parent Child page I want that ...
2
votes
1answer
18 views

How to get the media that owns a file?

I have a file and I know there is a media that references it. How can I get this media? In the opposite direction, knowing the media id, I can get the file: $media = Media::load($mid); $fid = $media-...
0
votes
1answer
27 views

Modules folder empty after git clone (submodules ?)

How do you pull/download submodules ? Some of my folder in /contrib/modules are empty after I did a clone of my site. Looking on the Gitlab website, the modules folder got a different icon with a ...
2
votes
1answer
30 views

How to know the block is disabled or enabled from block layout programmitcally in drupal 8?

I have 2 custom blocks. I have added both this in regions of block layout. But when i disabled the block from layout. I must identify it from code or api that the particular block is disabled. How to ...
0
votes
0answers
12 views

Manually sort Commerce 2 products within the taxonomy term (category)

I have a view to display my products (categorized by taxonomy term) in the frontend. I have another view admin/commerce/products to add new products in the backend. How do I implement and configure ...
-1
votes
0answers
38 views

Increasing PHP upload file size in “.htaccess” and “php.ini” not having any effect

I have tried increasing the limits in php.ini and also in .htaccess as following. php_value upload_max_filesize 30M php_value post_max_size 30M However, "http://drupal-8.dd:8083/admin/reports/status/...
0
votes
1answer
29 views

Error when applying patch

I seem to getting an error when trying to apply a patch and I'm a bit stumped on where I am going wrong if anyone knows that would be fantastic - I need to apply this patch: https://www.drupal.org/...
1
vote
1answer
24 views

How to affect kernel request hostname when bootstrapping from custom PHP script

I'm bootstraping from a custom PHP script using: $autoloader = require_once 'web/autoload.php'; $request = Request::create('/'); // $_SERVER['SERVER_NAME'] = 'whatever'; // $request->server->...
1
vote
1answer
35 views

Create a custom blocks visibility tab (show on certain domain only)

I want to show a block only on a certain domain. I know I can use the domain access module for this but this looks like a to heavy module for my use case. How can a create a custom visibility tab for ...
0
votes
0answers
25 views

JOIN subquery as right table in Views

I have a node field named event_date which contains multiple values of dates. The table for the field looks like this: node__field_event_date +----------------+------------+ | entity_id(nid) | ...
0
votes
1answer
19 views

Where to include common scripts

I am looking at adding a new javascript library to drupal 8. I want the ability to call this library from other modules / libraries. The way WordPress does this is by the use of wp_enqueue_scripts. ...
1
vote
1answer
19 views

Add inline styles/JS from fields to <head>

My site contains nodes which require different styles (and the occasional inline JS script) and the ability to adjust these styles through the interface rather than via code. These styles are ...
0
votes
0answers
23 views

Trying to make mass webforms more efficient

I have an application that we're migrating in to Drupal 8. Its a system that allows the creation of forms for our clients and then allows the submissions by their clients. We create base forms with ...
0
votes
1answer
36 views

Disable cache a custom block for anonymous user

I have a custom block, it displays in every pages with dynamic data calculates in every refresh, How can I disable cache for this block for anonymous users? I try with: public function build() { ...
0
votes
1answer
40 views

How to use service container correcly?

I want to use service container inside my class so I have this this: class SomeController extends ControllerBase { protected $entityTypeManager; protected $requestStack; public function ...
0
votes
1answer
26 views

DDEV php/twig error “Unknown ”link_attributes“ filter.”

So I'm trying to setup a local environment with ddev for the first time. I got it running, cloned my live files with git and imported my DB. Site ain't working and got this in the log : "PHP message: ...
2
votes
0answers
52 views

Dealing with installed modules/extensions in composer packages removed from composer.json [duplicate]

I had brought up a similar question on StackOverflow, but it hasn't gotten much traction because of a lack of understanding of Drupal, I think. The issue we are experiencing happens when a developer ...
1
vote
1answer
20 views

Job queue – dealing with stuck records

I have a cron job that gets stuck because I have a loop claiming items from the queue that ends on numberOfItems() == 0, which never happens because one of the queue items is stuck and cannot be ...
0
votes
1answer
25 views

How to add HTML5 attribute “autocomplete” to form fields?

According to an accessibility test, I have to add the HTML5 attribute "autocomplete" an the proper tags to all form fields on my website where the user fills in his/ her personal data. E.g. "Your E-...
1
vote
1answer
22 views

Change views exposed filter value only on page reload [duplicate]

Is there a clean way to alter a View exposed filter field, but only on page reload and not each time you submit the exposed filters form ? Example I have a View with exposed filters. When a user is ...
0
votes
1answer
31 views

Alter block form

I'm using the contrib module contact block and I would like to edit the block form settings. By default, there is a textfield (title) and the "Display title" checkbox, I need to hide those fields by ...
0
votes
0answers
42 views

How to customize the front page for each user of specific role?

For my Drupal 8 website I would like to display for the user after login some page /related-content/% where % is a contextual filter and needs to be replaced by the current user id. I have downloaded ...
1
vote
1answer
24 views

Bootstrap simple carousel: how to display it on front-end?

I've installed Bootstrap simple carousel module and I know how to add/edit slides. But I didn't find anywhere instructions on how to display them on the front-end. Module didn't create any new block, ...
0
votes
1answer
16 views

How to normalize / resolve membership ID to all account UID per group_content

I'm trying to add the owner's membership to every GroupContent. By default ownership is only identified by the Account ID. It seems a Normalizer and/or custom resolver is necessary. Beyond my ...
0
votes
1answer
22 views

How do I add more pages to views pagination on mobile?

I'm using Open Social and I want to add more pages to the paginationon mobile phones. One of my views has 11 pages of users and on mobile the pagination is as the following example (<< = ...
0
votes
0answers
44 views

how to convert a timestamp into a date format in a custom module [duplicate]

I created a custom module and printed this outcome in .csv. Name,Event,Email,Timestamp Ea Iustum Jus,Fifa,example@asdf.wer,1573924224 How do I convert the timestamp in a date format? I tried with $...
0
votes
0answers
38 views

How do I pull a value from a Paragraph field and put it in a template? [duplicate]

I would like to pull a value from a field I have in Paragraphs. I have a content type called "Landing Pages" (landing_pages) I have a paragraph type called "Landing Page" (landing_page) The field ...
-1
votes
3answers
48 views

How do I programmatically create a webform from a newly created node?

This is the code I am using. function walk_handler_entity_presave(EntityInterface $entity) { if (method_exists($entity, 'getType') && $entity->getType() === 'walk') { $elements = []; ...
0
votes
0answers
19 views

Migrate one to many relationship

My D8 site has two entities: resource author The resource entity has a field_authors entity reference field with unlimited cardinality. My source data is coming from 3 tables resource author ...
0
votes
0answers
30 views

Drag and drop between categories functionality for users [on hold]

I have a content type where user selects a certain status and data is sorted for each status through views. I want to build a drop and drop functionality where users could move the box of each content ...
1
vote
1answer
75 views
+50

How to enable click-sorting for views table display based on Search API index?

I'm trying to create a view with table display based on Search API (database search) index, with column-sorting (column set as Sortable in the display settings). However, this option isn't available ...
0
votes
1answer
54 views

Create new node and assign it to user after they have been registered

I have one user role on d8 and have few additional fields on user account so when people are registering they can leave additional data. What I would like to achieve is that when user registers - new ...
1
vote
2answers
77 views

What is the correct way to use a Symfony bundle?

I want to use https://github.com/KnpLabs/KnpSnappyBundle in a Drupal 8 project. How do I correctly use it?
0
votes
0answers
29 views

Displaying translated nodes in views [duplicate]

I am facing a challenge in displaying views for translated contents. Consider a general scenario: Multilingual site with English(site default), German languages. A content type Article has 100 ...
0
votes
0answers
17 views

How to get a second private files directory?

is it possible to create a second private files directory in addition to the existing private files directory? For a better file structure diversity I would like to set a different second location. ...
0
votes
0answers
29 views

CKEditor was grayed out after adding Content Security Policy [on hold]

I have a Drupal 8 website. I added CSP to the website header in .htaccess file. The code is, Header set Content-Security-Policy "default-src 'self'; *.cloudflare.com; www.google-analytics.com" After ...
0
votes
0answers
29 views

Cannot update modules, get a 403 error

An AJAX HTTP error occurred. HTTP Result Code: 403 Debugging information follows. Path: /core/authorize.php/core/authorize.php?batch=1&id=31&op=do_nojs&op=do StatusText: Forbidden ...
2
votes
1answer
40 views

How do I Install an earlier version of Drupal 8 with composer because install fails on server with PHP 5.6?

My server is using PHP version 5, therefore, I need to install Drupal 8 version 8.6.18. But when I try, composer create-project drupal-composer/drupal-project:8.x-dev my_site_name_dir --no-interaction ...
0
votes
0answers
28 views

webform ajax callback response not updating text, is something missing?

The code below works inside hook_form_alter. The description and price update from database as desired when in form_alter. I moved the code to the callback and now it wont return/update the values. ...
0
votes
0answers
60 views

How to load twig file in jquery? [on hold]

In controller, there is a function call displaypage() which return below param return [ '#theme' => 'page_test', '#attached' => [ 'drupalSettings' => [ 'test' => [ '...
2
votes
1answer
18 views

drush migrate-upgrade “[debug] key_value table not found. Database may be empty.”

I am trying to migrate a D7 site to D8 following the steps found here . Once I can manage it and make sure I have all the PHP components, Drupal modules and etc. I have 4 sites to update, and one ...