Questions tagged [8]

Version tags should be used 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
10 views

Where can I write SQL queries?

I am new to Drupal 8 and started to learning it. I am unable to find the way to write an SQL query in it. I want to know where to write a query and also the syntax of writing queries.
1
vote
1answer
13 views

How can I programmatically get the admin theme

Similar question to How can I programmatically get the theme name? and How do I programmatically change the admin theme?. I want to simply obtain the current admin theme machine name and human name,...
3
votes
0answers
31 views

Is it possible to pass variables as arguments to *.libraries.yml?

Say I have a foo.libraries.yml defined as so: external.bc.js: version: 1.x js: //players.brightcove.net/{{variable here}}/{{variable here}}/index.min.js: { type: external, minified: true} ...
2
votes
1answer
20 views

How to block all users not containing a pattern?

I'm trying to block all users except ones with a specific role, and would love to use something like: drush user:block !roadie.
0
votes
1answer
31 views

Breadcrumbs/menu for dynamic pages

Im breaking my head around getting the breadcrumbs set properly on views page. my views' page address is "teachers/%" where % is a term-id. I have a content type called 'program' with a field ...
0
votes
1answer
39 views

Update packages conflicting with core update

When updating drupal core via composer, you often get problems like: Problem 1 - Installation request for drupal/core 8.8.2 -> satisfiable by drupal/core[8.8.2]. - Conclusion: remove ...
0
votes
1answer
34 views

Render an HTML element before the menu with hook preprocess menu

I want to render an HTML element like <span>This is my menu</span> before my menu. I thought the most easy solution is to alter the menu. I already altered my menu to add a class. But how ...
0
votes
0answers
29 views

Adding “.xml” at the end of custom route path

I am trying to create custom route which will look like a xml file like this example.com/my/custom/path.xml and I am getting NGINX 404, it won't even goes to Drupal. I tried to research but I could ...
0
votes
0answers
16 views

Full node shows a different datetime(hour) value than the same field in a view

I have a content type with a "date and time" field. I have populated this field using core json post using this format 2020-02-19T13:25:00. This works good and field is filled. When I add this field ...
0
votes
0answers
14 views

Allow off-canvas dialog to be rendered on the left of the page in Drupal 8

this is my current code to display a custom block off-canvas. $build['link'] = [ '#title' => 'Select Sources', '#type' => 'link', '#url' => Url::fromRoute('heritage_ui.sourcesmenu', ['...
1
vote
1answer
32 views

Creating a custom field with dynamic/virtual computed property value

I’m working on a custom field (Drupal 8) where the author selects a taxonomy term from defined list, but the display is of, or includes, a node that references said term. I already have a service that ...
1
vote
1answer
12 views

Add text message under “Add new comment” title

I would like to add a disclaimer message under "Add new comment" title and above the form in drupal 8 site. I changed the help text on this path /admin/structure/types/manage/article/fields/node....
0
votes
0answers
18 views

Unable to auto-create node from webform

I attempted to create a custom module that automatically creates a node upon submission. I used the second response in this post: How to create a node out of a webform submission? Per the ...
0
votes
0answers
17 views

How to update default value of a datetime field?

I have a content type 'News' with a datetime field. I'm trying to alter its default value depending the choice of another field. So, i added some AJAX in the form : <?php /** * Implements ...
1
vote
0answers
14 views

Use default language domain when editing translated content

I have a multi-lingual site setup that uses two domains: example.com (Primary/Default English domain) example.mx (Spanish translation) When editing translated content the user is forced to 'example....
0
votes
0answers
30 views

How can I add a “target” attribute to a custom form?

I've made a custom form in a module in Drupal 8, but I'd like to add target="_blank" in the form tag. When I try to add it in $form['#attributes']['target'], the attribute is shown in the wrapper of ...
0
votes
0answers
24 views

How can I reference previously imported media entities - Drupal 8 Migration

I have been trying to attach media entities to node entities in Drupal 8 with a custom migration but despite numerous attempts and countless hours reviewing forums i'm stumped - I'm desperately hoping ...
0
votes
0answers
19 views

twig check if image style or view mode exists

I have a site design the i need to implement. in this design I have a grid and in the grid I can put any content (node/paragraph) that i choose. the image of the content changes size and ratio in ...
0
votes
1answer
25 views

How can I have multiple content types pick up the same template?

I want to override the template for 5 content type that they have all the same attributes, but a different name ,so the suggestion is : node--contenttype1.html.twig node--contenttype2.html.twig ...
0
votes
0answers
12 views

How can I disable the default form validation error message?

I am using Drupal 8. When using "webform" module with the "inline form error" module, it shows both the validation error summary above form and each field error under the field. How to disable the ...
0
votes
0answers
10 views

How to sort nodes in a view with current language first

How would I sort nodes in a view to show nodes translated to the current language first? This would then show nodes that haven't been translated to the current language after nodes that have been ...
0
votes
0answers
33 views

Error on cron : Link could not be converted to string [duplicate]

Everytime cron try to run this error appear and everything stops. All I could find is that a Link is passed in filter Xss function when the cron try to index the website search. If I comment the ...
-1
votes
0answers
25 views

problem on content on editing [closed]

when I try to enter content on my drupla 8 on structure I get this error Le site Web a rencontré une erreur inattendue. Veuillez essayer de nouveau plus tard.Drupal\Core\Database\...
0
votes
0answers
24 views

How to access the block ID in hook_block_view_alter()?

How can I access the block ID in hook_block_view_alter()? function mysite_block_view_alter(array &$build, \Drupal\Core\Block\BlockPluginInterface $block) { if ('my-block-id' == $block->...
0
votes
0answers
27 views

Can hook_preprocess_block() be used to alter the block content?

I'm finding I can't alter block content with hook_preprocess_block() in Drupal 8. Should I expect to be able to alter content, such as a block body, using hook_preprocess_block()? For example, this ...
0
votes
0answers
28 views

Exclude node from search API results based on values in existing fields

My content node includes a verified checkbox that's marked by a human reviewer who then also enters a date. The node is verified only when the box is checked and the date is entered. A content node ...
1
vote
1answer
19 views

Adding a base field definition in an update hook - it's not appearing

I want to add another base field to a Drupal entity. It used to be possible to just change the code for the entity definition and then update it via the Drupal console. But now it has to be done in an ...
1
vote
0answers
31 views
+100

How to skip empty and missing values from a migration

I'm trying to skip fields that are not present in my source file or that are empty, but I keep getting "Migration failed with source plugin exception: Passed variable is not an array or object" This ...
-4
votes
1answer
34 views

How can you separately get the name and the value of a field?

I want to get the key and the value of my row for example I have this: {{ content.field_nom }} but the out put is: my field name my value My question is how do you get 'my field name' alone ...
-1
votes
1answer
24 views

How can I use Twig tempalte to handle label of form input field?

In a custom module (association), I have a form (MembershipStep3). I'd like to use Twig template to handle form fields titles and need some advice about that. In association.module, I have this code: ...
0
votes
0answers
10 views

How do you simulate Google login with the Drupal 8 social auth module in ones local server?

I am trying to test Google login in my local machine to capture the event and activate the user automatically. I had run code to simulate the triggering of the event but that might not be authentic ...
-1
votes
0answers
15 views

Download html into pdf using Dompdf. Indian fonts shows up as garbage after download [closed]

I am using Dompdf to download html content into pdf. It works fine for english, but shows garbage texts for Indian fonts.The indian languages that I want to print are already configured into Drupal. ...
0
votes
0answers
21 views

Path to image file in theme folder for use with image_style

How can I use image_style settings on an image in my theme? The twig way I use for images, which are stored in fields is like this, with the help of Twig Tweak and Twig Field Value modules. <!-- ...
2
votes
1answer
63 views

Why this specific string is untranslatable

I want to translate "You can only change the parent menu item for the published version of this content" which belongs to Menu UI module. The string is defined in /core/modules/menu_ui/src/Plugin/...
0
votes
1answer
12 views

address dependent locality field not shown

drupal 8.8.2 address 8.x-1.7 address module is working in that i can add an address to my content, however I am not able to display the "dependent locality " field even when it is set to "no ...
1
vote
1answer
20 views

Override entity form handler

I'm trying to alter an entity form handler. The method EntityType::setHandlerClass() allows for the 'form' handler to be set, but this value is an array, and I only want to override a single item of ...
1
vote
1answer
16 views

Use a custom install profile for Nightwatch tests?

How can you set a custom install profile to run a Nightwatch test in? I am not seeing it in the docs. The definition of the .drupalInstall() command has: commandAsWebserver( `php ./scripts/...
1
vote
1answer
35 views

How do I change the salt used for the user password when creating an account?

I am working on Drupal 8 site where the client has asked us to use their own custom salt when storing the user password in the database. Is it possible to set a custom salt for a Drupal site? The ...
0
votes
1answer
33 views

Can't set a default theme in a FunctionalJavascript test with $defaultTheme class property

Trying multiple ways here to set a default theme to use in FunctionalJavascript tests and it is not working (I am watching them execute in VNC viewer). Bartik always shows. I also tried setting $...
-3
votes
0answers
67 views

Is it formally correct to define Drupal as an SDK? [closed]

When I read about creating server environments for a Drupal applications, I often come across the terms Cloud and SDK. Well, one can indeed develop sophisticated software with Drupal, above "clouded" ...
1
vote
1answer
70 views

How can you display document file sizes next to a media link button?

I'm trying to display the file size of a file next to a media link button on a page. I have two content types with a media entity reference field in each. Each field is restricted to only pull from a ...
1
vote
1answer
40 views

Twig: How to access multiple values from node reference field with number_format

I'm adding fields to array: {% for item in content.field_notes | field_target_entity %} {% set field_component_pages = item.field_component_pages|view|number_format %} {% endfor %} In my ...
-2
votes
1answer
18 views

Change Superfish menu on specific pages

Is there any way I can change the menu in Superfish module in specific pages? What I know so far is that Superfish uses the "Main Navigation" in the admin structures by default. Can I create a ...
3
votes
1answer
61 views

Avoid hard crash if user searches when Solr stopped

I use search_api_solr with a server-based Solr installation. Works fine. For reasons I won't explain, the Solr service is stopped sometimes. If a user does a search while Solr is stopped, they crash ...
1
vote
1answer
33 views

Difference between creating a Rest endpoint and a route&controller with jsonResponse

What is the difference between creating a Rest plugin with the Rest API and creating a route/controller that returns a jsonResponse ? In which case i have to create a custom route/controller with a ...
0
votes
1answer
23 views

drupal 8 modifying the menu items path

I work on an drupal 8 application that use the group module with the restriction of only one group per user. i want to be able to modify the menu items so that the id of the user's group is always in ...
-1
votes
1answer
50 views

Drupal challenges for learning [closed]

For newbie Drupal developers: Is there a repo, blog post or similar with increasing difficulty challenges? I am willing to test my skills, which may be more than basic. It would be nice to have a ...
0
votes
0answers
15 views

How to join a custom table in Views based on a node's field value?

Let’s say I have a Drupal content type of Widget that has an integer field “widget_id”. I have a custom MySQL table called “new_widgets” with the fields “id” and “widget_name”. I’m trying to create a ...
-2
votes
0answers
41 views

How would I have a custom PHP page rendered by Drupal?

I have built a website using html, css and php. I have downloaded and installed drupal 8 to use a CMS system to take the sites design to the next level. I have ordered one book and been searching ...
0
votes
1answer
27 views

When does the user interface translation gets updated?

If you turn off "Check for updates" in /admin/config/regional/translate/settings, on what occasion does the user interface translation actually gets updated? As far as I know there're two ways to ...

1 2 3 4 5 282