Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

0
votes
1answer
7 views

Module Library JS Some In Header Some In Footer

I have read that Drupal 8 by default loads library-defined files into the footer. My module libraries.yml file makes use of the "header: true" property as several JS files are needed to load in the ...
1
vote
0answers
14 views

What is the correct way to get the value of a field? [duplicate]

We have several fields on the Article content type such as field_headline (plain text field). When we try to access the value of this field in a module hook such as mymodule_preprocess_page (mymodule....
0
votes
3answers
17 views

How come I cannot fetch the name of the taxonomy term from term id?

We are doing the following query below to fetch all the taxonomy term values in the term_category vocabulary term. When we do the following query below, we get NULL value returned. Content Type: ...
-1
votes
1answer
12 views

Post form min max value

I have a custom form with min and max price value: $form['price']['min'] = [ '#type' => 'hidden', '#default_value' => isset($_GET['price']['min']) ? $_GET['price']['min'...
0
votes
0answers
21 views

How do I use an older jQuery version?

Drupal 8.5 requires jQuery 3, which has some site breaking features. I would rather like to use version 2.2.4. I have tried the libraries-override approach suggested in How do I use a jQuery version ...
-1
votes
0answers
20 views

How do I write a custom module to leverage the Nodeaccess module?

After doing some research, I have figured out that I can use the NodeAccess module to control some key permissions. Specifically, I need to grant access to a specific user (that is also referenced via ...
0
votes
0answers
9 views

Howto check if a form contains custom type field in hook_webform_submission_form_alter?

How to check if my custom element is added to form in hook_webform_submission_form_alter. Below is the screenshot what i am getting in form array. Custom composite element can be nested under 3 or 4 ...
-1
votes
1answer
20 views

Field collection does not show on the page

I've installed filed collection on drupal 8 version. Now I'm trying to add field collection named "field_ingredients_second" to a content type. And then I've added fields to this newly created field ...
0
votes
0answers
16 views

Render node in page manager variant

In D7 we could render a node in a particular "page manager" variant by the following module_load_include('inc', 'page_manager', 'plugins/tasks/node_view'); return page_manager_node_view_page($node); ...
0
votes
1answer
10 views

Migration Source YML File import date string into date and time field of content type

I have a json file full of data exported from a wordpress site, one field being a string representing a date and time: "03/15/2012 14:46:19". I would like to import that string into a date and time ...
1
vote
1answer
12 views

How to reorganise files location without updating each node manually?

In my file system, I have different folders where are stored the files linked to the nodes (either pictures in the body of the node or pictures in a 'Gallery' field I added to custom content type). ...
0
votes
0answers
10 views

Get custom taxonomy fields [duplicate]

I am trying to get a custom field assigned to taxonomy. I have tried this: $vid = 'zeme'; $terms = \Drupal::service('entity_type.manager')->getStorage("taxonomy_term")->loadTree($vid); $...
0
votes
0answers
12 views

Graphql views integration queries

I create a simple Graphql view with query name: "mostPopularGraphql" and then try to execute in explorer(graphql/explorer) query { mostPopularGraphql { results { entityLabel } } } I got this error: ...
0
votes
0answers
18 views

Why does the same form/field appear diffently depending on the browser? [on hold]

I have a custom content entity created with Drupal Console and the corresponding CRUD forms. In this entity there is a field defined this way: $fields['startdate'] = BaseFieldDefinition::create('...
0
votes
0answers
17 views

Update the block through ajax

I have added a block which shows the no of items added to an entity. I want to refresh the block through ajax as the items are added to an entity through ajax form so whenever I add an item, it will ...
0
votes
1answer
34 views

How do I load CSS files to a custom theme?

I understand this question has been asked many times. However, I still can't figure out why the CSS files of my custom Drupal 8 theme are not loading. Edited (more info): The CSS files are not being ...
0
votes
2answers
16 views

Theme filter for a view

How can I theme filters for a view in drupal 8? I would like to place the filters to the sidebar menu, and rather than having standard either dropdown or autocomplete field, I would like to have ...
0
votes
1answer
13 views

Commerce Product listing View with category contextual filter, How to show items of (selected term and its child terms)

I have a the view 'Browse Products by Category' with the path: /taxonomy/term/% and a contextual filter: Product: Category (field_category) and let's say I have these categories: Sensors --- ...
0
votes
0answers
24 views

How to set relation name in insert()?

I'm trying to do an insert query on a external PostgreSQL database with Drupal 8 : $db->insert('site') ->fields([ 'civility' => 'mr', 'firstname' => 'firstname', 'lastname' =...
0
votes
2answers
21 views

How do I programmatically load an order by its properties?

I know how to load an order by its ID using \Drupal\commerce_order\Entity\Order::load($order_id). I added a custom field (Token ID) to the orders. How can I load the orders knowing the value of that ...
1
vote
1answer
10 views

How do I add reCaptcha to a form? [on hold]

I have a custom form on my site, and I want to attach a reCaptcha to it. I wasn't successful using the Drupal 7 code for this. Suggestions?
0
votes
0answers
20 views

No breadcrumb on front page

I've a Drupal 8 (8.5.4) site which is using a custom created on top of Bootstrap Barrio. I'm using Easy Breadcrumbs module. Here is the configuration I used. Easy Breadcrumb settings The default ...
1
vote
1answer
14 views

How to retrieve value of start date with format end date?

I D8 installed the module Optional End Date in order to add an optional end date within a date field. When I had a single date field value I could get the value by using: $datum_deelname = $node-&...
1
vote
1answer
29 views

For a customer database table, do I have other options, beside creating a custom module?

I'm upgrading my site to Drupal 8. Currently, I have a custom module with a custom database table and I query that to provide historical data that is in the table. The data is really purely tabular ...
0
votes
0answers
12 views

Manage Display Field Label not changing: inline does not work

I have the same problem as question 212176 and discovered it has to do with CSS. I have 2 (local) sites both with module ds enabled. I configured in both a field where I want the label and the value ...
0
votes
0answers
21 views

How would i Add form fields dynamically via drupal ajax like the example below?

I've tried to use the addmore form from the examples form but im a little confused with adding the additional fields and having the fields appear in a row on the next line?? // Gather the number ...
0
votes
0answers
27 views

Block caching prevents the javascript from always being loaded

I have added a custom block and added javascript along with that, But javascript is not working when i enable the cache and on removing the cache, the content doesn't get updated. I have added the js ...
0
votes
0answers
24 views

Behaviors are only called the first time a view is loaded

On a Drupal 8 site I have a world map where the user can click on a country; a view with content is then loaded with AJAX using a custom module and the following JavaScript. (function($, Drupal, ...
1
vote
2answers
55 views

How to properly define and return simple array computed field property

We created a custom field type featuring a computed classes property that returns a simple array of generated CSS classes. The field itself allows content editors to define styling options depending ...
0
votes
0answers
29 views

Can we move the directory “private” without breaking the site?

I have a site with Drupal 8. I changed the directory containing my drupal site, now I have this message in the dashboard: "Writable (public download method) The directory /home/www.domain.com/...
0
votes
0answers
25 views

Passing field values to hook_mail_alter()

I'm new to Drupal so I'm sure this is a simple question for some. I looked around but I keep finding either D6 or D7 solutions. Nothing on 8. This is what I have in my form alter. if ($form_id == '...
-1
votes
0answers
16 views

Chart into a form with filters? [on hold]

I developed a Drupal 8 CRUD module. I would like to show the stored data in a chart/graph, dynamically, using filters. So I'd filter and generate dynamic charts, using a form to select options. I've ...
0
votes
0answers
21 views

How to change the collation of an existing MySQL database? [on hold]

How to change the collation of an existing MySQL database ? This is a Drupal 8 site Currently my database is with collation utf8_general_ci Is it possible to convert an existing database with ...
0
votes
0answers
14 views

Add JavaScript on order completition

I'm trying to integrate the facebook pixel into my codebase. I need to be able to tell the Javascript the order total when an order is complete. So far I have subscribed to the commerce_order.place....
0
votes
1answer
26 views

Render field values in node template

Hello I'm working on a module, I currently have an array with Node objects (custom content types), I am passing this array to a custom template (twig) but I can not render it with the values of its ...
0
votes
0answers
19 views

How does a PaymentGateway signal a completed order

I'm trying to implement the Commerce Ingenico payment gateway for a Drupal 8 Commerce site. As this module is still in unfinished for Drupal 8, I'm fixing it up as I go. Most of the implementation is ...
0
votes
0answers
26 views

Creating a column in mysql to store uuid

In Microsoft SQL we have UNIQUEIDENTIFIER type while creating table and when inserted it fills auto-generated string into that row. Is there any equivalent type in Drupal 8 or should I use some ...
0
votes
0answers
15 views

Same layout, different contexts

I'm working in Drupal 8.5. I have a requirement to create a re-usable widget that the content editors can use to place a set of arbitrary statistics on the home page or elsewhere. So far, this doesn'...
0
votes
0answers
15 views

How to render an AjaxResponse manually? [duplicate]

I have a Drupal 8 form within an AjaxResponse that I want to manually invoke from a JavaScript file. What is the best way to do this? Will the jQuery load() function work?
0
votes
0answers
26 views

Which hook_view_ is always executed and never cached?

In D8.6 I have problems with counting in a view. After the counting a message in the site should display the total. The message is sometimes show and sometimes not. I used several different view ...
0
votes
1answer
15 views

Is there an error in Drupal with hook_views_post_execute? [on hold]

In D8 I would like to sum a field in a view within a custom module called nvgh. I choose to use a hook for a start. I'm not sure this will be the good hook anyway. https://api.drupal.org/api/drupal/...
0
votes
1answer
18 views

How to use token [comment:original:url:absolute]

I want to use the token service for [comment:original:url:absolute]. As far as I understand, it should be something like this $message = $token->replace('Hello the comment is: [comment:original:...
0
votes
1answer
22 views

entityQuery with multivalue date field

Is there way to use entityQuery in order to select nodes with multiple value date field. For example we have a content type event with a field field_event_date which may contain unlimited number of ...
0
votes
2answers
30 views

How can I add “data-target” additional attribute in mega menu?

How can I add an additional attribute to menu item I am using mega menu? On element inspect my current menu url is displaying as : <a class="we-mega-menu-li activeNav" title=""href="/clients/...
0
votes
2answers
31 views

Select data from database

For the filter block I need to get the data from database. I have three tables "node", "node__filed_country" and "taxonomy_index". So I need to pull only those taxonomies which are realted to the ...
0
votes
1answer
15 views

How to disable input field but show tekst with hook_form_alter?

In D8 I have a form with several fields. One specific field is a number. Input widget is Integer. This field is prevalued with hook_form_alter like: $nid = \Drupal::request()->query->get("...
0
votes
1answer
26 views

Prepend custom block body text

I have a custom block with text in the body field. I need to prepend some text to this body field, either using php in a theme_hook function or in a twig file. How can I get just the text of the body ...
0
votes
0answers
19 views

How can I render a modal dialog? [duplicate]

I'm trying to render a Drupal 8 modal dialog form through JavaScript, so it can appear on multiple pages across my site. In the controller class, I create an AjaxResponse object with an ...
0
votes
1answer
46 views

How do I render a form with JavaScript?

I'm trying to render a Drupal 8 modal dialog form through JavaScript, so it can appear on multiple pages across my site. In the controller class, I create an AjaxResponse object with an ...
1
vote
0answers
24 views

Add custom fields to an existing entity

I would like to add extra fields to an existing entity WebformSubmission : Assigned to (entity reference to a user) Status ( taxonomy term reference) for these two fields I will need it to be ...