Stack Exchange Network

Stack Exchange network consists of 175 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

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.

0
votes
0answers
3 views

How to print the relative url or node id for each referenced node in twig?

I am using paragraphs to render a number of nodes on a page. The nodes are obtained through an entity reference field called 'field_nodeslist' in my cards paragraph type. The cards are then rendered ...
0
votes
0answers
4 views

How to migrate file uploads from Drupal 6 to 8?

I'm working on a custom migration from Drupal 6 to Drupal 8. Some of the content types have a field used for file attachments. In Drupal 8 this field has the internal name field_attachments. When I ...
0
votes
0answers
6 views

8: Datetime field show different format browser wise

I have tried https://www.drupal.org/project/webform/issues/2990482 https://www.drupal.org/project/drupal/issues/2791693 For Drupal 8.6.3, but it's not working.
0
votes
0answers
8 views

loop through paragraphs ID's in node template

In a custom twig template for content type "legal", I'm trying to loop through a 3-field paragraph called "legal_section." It's referenced by my content type, using an entity reference field called "...
0
votes
1answer
5 views

Excluding inline images in views

I have a node type with an image field and insert button to get the image into the text field. Then there is a view that is getting the content of the text field and shortening it to 150 characters. ...
0
votes
1answer
12 views

How to add the view name as body class

function THEMENAME_preprocess_views_view(&$variables){ $view = $variables['view']; if($view->name == "YOUR_VIEW_NAME" && $view->current_display == "MACHINE_NAME_OF_VIEW"...
0
votes
1answer
21 views

Hook for Node Add Field?

For my use case, this question revolves around the entities node and paragraph. Fields in my projects are created under the following structure: content_h2 paragraph_h2 content_p paragraph_p ... ...
0
votes
0answers
16 views

View filter settings not selected properly in production environment

I have a group of block views for various program pages on my site which have a filter for an area of interest. Within my "Area of Interest" taxonomy term are numerous areas for the different groups. ...
0
votes
1answer
10 views

Override view-list and get items properties

I'm currently working on Bartik theme and i'm trying to create a custom template for the Content-Recent block available in Drupal 8 For your information, i would like to create the following block ...
1
vote
1answer
33 views

Why return AccessResult::allowed() ends up with “Access denied”?

I'm having a strange behaviour while trying to use hook_node_access in Drupal 8 (Lightning to be more precise) and I can't figure out why is doing this. Let's suppose that I want to always allow ...
0
votes
1answer
25 views

ThemeNegotiator not working for admin pages

I'm trying to use the ThemeNegotiator to change the theme of the add and edit pages of one content type. I've followed the following very extensive posts/blogs. Don't use admin theme for adding ...
1
vote
0answers
21 views

kint() my_theme_preprocess_node error [on hold]

After using kint in my 'mytheme'.theme file to output the variables : function my_theme_preprocess_node(&$variables){ kint($variables); } I get the following error: RuntimeException: Failed ...
0
votes
1answer
36 views

How to access all the parameters in URL without getting a “page not found” error? [on hold]

I used this code in Drupal 7 can access all parameter. Example: $items['hello'] = array( 'page callback' => 'hello_handler', 'title' => 'Hello page', '...
0
votes
1answer
24 views

Using ImageStyle with dependency injection

Is there a way to use the ImageStyle class with dependency injection instead of a static call? I am struggling to find an example. At the moment I have a block which is importing the class with ...
0
votes
1answer
32 views

How can I add folders to my template directory and have Twig find them?

I was listening to a Drupal Developer on youtube and one of the suggestions he has, is that when you go into a template folder, create some subdirectories for easier management, like this: Templates -...
0
votes
1answer
24 views

How to print the URL path of a referenced node using paragraphs?

I'm trying to print out the url path of a node from a referenced entity paragraph field in my twig template however have not had any success so far. I have tried various common twig functions but with ...
0
votes
0answers
38 views

How do you get and submit a webform in React?

I am planning to build a Drupal 8 site fully decoupled using Gatsby (a site generator for React). So I will use Drupal only to structure (content types, paragraphs), enter and update all the content ...
0
votes
0answers
12 views

Subrequests: Assigning Paragraphs entity to node

Migrating a content type from D7 into a greenfield D8 app, so I'm using Subrequests and jsonapi modules. My first subrequest to create a simple Paragraph returns the new ID and it properly replaces my ...
0
votes
1answer
17 views

How to show contextual links / quick edit links for blocks

I'm building a Drupal 8 template/theme from scratch, and it is not showing the contextual editing options for my blocks when I view a site page. I.E., the little circles that are clicked to see ...
0
votes
0answers
12 views

Automatically add meta tags on node creation

I'm currently maintaining a lot of different sites containing the same information pages (example: profile pages with the same content but on different sites/base URL) and I'd like to consolidate this ...
0
votes
0answers
21 views

Provide autocomplete field with user's Display Name

Drupal core already supports autocompletion of username fields. However is there a way to provide autocomplete for user's Display Name? Since this is a virtual field, a database query with % like ...
0
votes
0answers
21 views

Render content type display mode in custom module [duplicate]

I'm facing the issue with rendering content type in specified display mode (teaser) in my custom module. I have a module which stores NIDs in session, and when user enters specific page, I want to ...
0
votes
1answer
66 views

Is there a better way to style fields?

I'm learning twig and using it to format and style my fields. The problem I am running into is that I need to create a new twig template for each individual field. In the example picture, I have ...
0
votes
0answers
46 views

How to stop a local database from launching the online website?

I'm a designer and new to Drupal. been studying for a couple of months creating sites for personal learning. I started working in a company that had a Drupal 7 website. I studied, learned it and ...
0
votes
0answers
45 views

How do I differentiate between different node dates?

A site owner wants to differentiate between semantically different dates of articles published on their Drupal site as follows: Editorial changes on an article will NOT create a new revision. Content ...
0
votes
1answer
26 views

How to print the URL of a title field?

I'm trying to print out the url path from the title in my twig template however I haven't been successful so far. Printing out the title containing the link works fine using: {{content.title}} ...
1
vote
1answer
39 views

How to use hook_prepare to modify a field of a node before it is edited

I want to modify the contents of a field of an Article node just before it comes up for editing. I have read the documentation at http://api.hostdog.gr/api/drupal-8/drupal%21core%21modules%21node%...
1
vote
1answer
40 views

In code, only create a revision if a field is changed

I have a custom revisionable entity with a few dozen fields. I'm importing data about the entity on a periodic basis. If the entity has changed, I'd like to save it and create a new revision. $dogs =...
1
vote
1answer
20 views

Is the homepage considered in_active_trail?

I'm learning Drupal 8, so still very new to it. I'm working on customizing the main menu. I've been able to add Twitter Bootstrap to my custom theme. I've made a custom menu--main.html.twig file. I'...
-1
votes
0answers
27 views

Export / Import Users Drupal 8

I am loking for a way to export users from one Drupal 8 Site into another Drupal 8 site. Is it possible to do this by exporting and importing the Users tables? If so which ones? I see there are ...
-1
votes
0answers
16 views

Provide a field that lets editor select content types?

I have a Paragraph that when rendered, injects a View. This view is being built and constructed in a preprocess hook in the theme, with arguments injected from a field. The field just lists all the ...
-3
votes
1answer
57 views

Use a Twig filter to resize / crop images in templates

I want to use a twig filter to resize/crop images in templates for responsive images, I know I can generate responsive images with Image Style and Responsive Image styles, but that requires too much ...
-1
votes
0answers
13 views

I want to configure content from external API results [on hold]

There may be existing documents, but because it is not familiar with English and it is the first time to develop drupal, no information to help me has been found. What I want to implement is as ...
0
votes
0answers
22 views

form : I need to prepopulate an entity reference multi value field depending on select list

I need to prepopulate an entity refence field depending on a list selection field. If the user select liste "administrator" then ajax need to prepopulate the field with users asssociated to this list....
0
votes
2answers
26 views

Get value of programmatically (form_alter) added fields at form submit

I'm altering a node creation form using the form_alter hook in a custom module. In this particular case, I'm adding an email field which is not part of the content type structure. At the node creation,...
1
vote
1answer
18 views

Set value on a new term based on a vocabulary custom field

I want to set the value of a field of a term based on a custom field set on the vocabulary. Basically if the vocabulary promote_to_index field is checked I want to the field_index_page of the term ...
0
votes
2answers
46 views

Print a view inside a block

In Drupal 7, I use the following code to print more than one view inside a block. <?php print views_embed_view('view_name', 'display_name'); ?> In Drupal 8, it doesn't work and it returns ...
-1
votes
1answer
22 views

How to make redirect in jQuery callback function? [duplicate]

When I use this $form_state->setResponse(new TrustedRedirectResponse($url, 302)); in submitForm() it works fine. But when I try to use it in jQuery callback function it doesn't redirect me. How to ...
0
votes
0answers
27 views

Print a webform submission from a printer after successfully validating and saving it [on hold]

Drupal 8.7.1 site connected via bluetooth to a printer device. I have use case where I need to print a webform submission after the user has successfully submitted the webform. I have searched too ...
2
votes
2answers
117 views
+100

Delete a block of all layouts

I am using Layout Builder (Drupal 8.7.1) I have a block in several Layouts. How can I programmatically remove all instances of this block and update all layouts without the message "This block is ...
0
votes
1answer
24 views

Extending a base template file such as field.html.twig renders no results?

So I have a custom content entity that has the typical attributes. Name, Author, Creation Date, ect. In the 'view' tab of this content entity, it displays said name, author, ect. When I hover over ...
1
vote
2answers
25 views

Set a multiple field value on a form

I use this field definition in the entity "message" class. $fields['fichier'] = BaseFieldDefinition::create('file') ->setLabel(t('Fichier attaché')) ->setSetting('file_directory', '...
0
votes
1answer
17 views

REST Export Views and images alternative text

I have a simple REST export View. The View format is set to "Show: Entity". The content type I am exporting contains a standard image field. My image field settings is set to "Enable Alt field" and "...
0
votes
0answers
24 views

Steps to make a private file system working on a fresh install?

How can i make my media files stored as private and protected? The users shoud only have access to that file if they click from the node file link, on nodes they can access to. On a fresh install,the ...
0
votes
1answer
26 views

How to reference without tagging?

My problem is a priori simple: I would like in a node to refer to the terms of taxonomy that concerns this node, but without "tag" this node, ie: without the node is referenced in the list ...
0
votes
0answers
25 views

Why is my custom twig template not being selected by Drupal?

So I have a custom module that has boilerplate template code inside it. No problem there. So I following the Drupal Docs which says to create a service.yml file and turn debug on and caches off. Done. ...
0
votes
1answer
21 views

How do I override the base URL for private files?

Why in Drupal 8 is possible to override the base_url for public files using the file_public_base_url but not for private files? There are scenenarios where Drupal is installed behind a reverse proxy. ...
1
vote
1answer
13 views

setHandler into views_pre_render OR count results in views_pre_render

I have a view that needs to have a custom views footer only if it get results. Otherwise the view needs to not be displayed I can set up a view footer by using $view->setHandler with ...
3
votes
1answer
44 views

How do I override the mail system?

In my application, all mails aren't sent via the Drupal default mail system or SMTP. We have a third-party API which sends all emails. So, whenever the plugin.manager.mail service is called, the class ...
0
votes
0answers
12 views

'drupal ci' command doesn't work with config split and config ignore modules, is there an easy fix?

After drupal update from 8.6.x to 8.7.1, the config_ignore module stopped working with 'drupal ci' command. I tried config split, it doesn't work also. Is there an easy way to fix it?