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.

4,059 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
14 votes
0 answers
2k views

How do I translate theme settings?

How do you translate custom theme settings in Drupal 8? I use hook_form_system_theme_settings_alter to add custom settings to a theme. One setting is the text string (e.g. 'Menu') to display beside ...
Peacog's user avatar
  • 528
12 votes
0 answers
1k views

With search_api_solr, how can I apply an significant field based boost when using solr 6.x?

I am using the solr backend for search_api on a drupal 8 site. I have added the value of a taxonomy term reference field (field_promoted_search) to the index. If an item of content has ...
autopoietic's user avatar
  • 1,672
10 votes
1 answer
1k views

How do I theme a modal popup?

How can I style Drupal 8 modal window to achieve Instagram style and behaviour? I'm creating modal through extending ControllerBase class, thus have full control of content. However I can't figure it ...
Jonas's user avatar
  • 101
8 votes
2 answers
755 views

Managing custom aliases on translated content

We have a Drupal 8 site with translated content, and using the Pathauto module. The issue we are running into is that when we un-check the "Generate automatic URL alias" on, say, the Chinese node, ...
aburke626's user avatar
  • 371
8 votes
2 answers
2k views

Configuration changes that will not import?

I have some configuration that will not import. If I run drush config-import --preview I see the changes to be imported; I hit 'y' to import. When I run the same command, the changes are still there? ...
dbj44's user avatar
  • 4,754
8 votes
2 answers
4k views

Migrate address field

I am currently searching for a example to migrate data into an address field in Drupal 8 without any luck for now. Has someone a hint for me on how to map the fields? I tried the following: my....
Sebastian's user avatar
  • 635
8 votes
2 answers
3k views

Add Expression for Entity Query

I've been working with the entityQuery to query the db and get an array of filtered nids however I need to add an expression to my query. I've checked the Query class and found a protected sqlQuery ...
113408's user avatar
  • 326
7 votes
0 answers
551 views

Execute form custom validator first before default validation

I have added a custom form validation on node/add page in drupal 8. The purpose of adding this validator is to add a slash before the path alias string. By default if a path alias string is added ...
Umed Godd's user avatar
  • 317
7 votes
1 answer
167 views

Update core keeping other composer packages

After upgrading Drupal to the last version with Drush (8.1.15) the other composer.json dependencies (e.g. drupalconsole) are removed. Are there any way to update Drupal with Drush keeping other ...
jorgetutor's user avatar
  • 2,125
6 votes
0 answers
301 views

How to get referencing parent entity when adding entities via Inline Entity Form to set automatic titles?

I have a content type "Parent" and a content type "Child". When adding Parents, the user can add Childs via Inline Entity Form. Child content types have Automatic Entity Label enabled. In that ...
Alex's user avatar
  • 2,503
6 votes
0 answers
635 views

How can I convert an existing image field into a Media image reference field?

I have an image field that I created before Drupal 8.5, when media was introduced in the ui. The field already contains content and I would like to make use of the reusable media functionality that is ...
Pekens Antoine's user avatar
6 votes
1 answer
160 views

Benefit of config entities over regular config entries?

In Drupal 8 it is possible to store configuration in "config entities". However, the same can also be achieved with non-entity config entries. E.g. one example for a config entity schema, from core....
donquixote's user avatar
  • 3,642
6 votes
0 answers
1k views

How to create a Draft view with Content Moderation?

In Drupal 7 with Workbench Moderation is easy to create a view to show the last Draft of a content: You have a relation in the view named Workbench Moderation: Node, so using the filter Workbench ...
Adrian Cid Almaguer's user avatar
6 votes
3 answers
3k views

How do I define a computed field equal to the concatenation of two fields of my custom entity?

I have a custom entity (Person) with these fields: ID, nom, prenom, telephoneportable, estactive, userID, created, changed. I created it with baseFieldDefinitions. I want to have a computed field ...
gbmapo's user avatar
  • 1,066
5 votes
0 answers
466 views

Configuration export via drush randomly change the value of labels\other content in multilanguage sites

I've a multilanguage site, with Italian set as default and English as secondary language. When exporting the configuration via drush - drush cex command - sometimes the labels of other kind of content ...
Giuseppe's user avatar
  • 939
5 votes
0 answers
560 views

How to add translation to Inline Entity Form + Entity Browser

Situation I've got a special "Dashboard" node that consists of entity references to other node types. In dashboard form mode all widgets are configured to use Entity Browser to display an (Inline ...
Hudri's user avatar
  • 5,500
5 votes
1 answer
927 views

Invalidating render cache items for anonymous?

We have a certain content type in Drupal 8 that has a small grid of data on it that is populated from an API call when the node view is being built. In that call, I am checking for cache and setting ...
Kevin's user avatar
  • 27.8k
5 votes
2 answers
4k views

How to pass a field value as contextual filter argument using Twig Tweak drupal_view?

In Drupal 8, I'm using Twig Tweak to embed a view. I have a contextual filter set to one of the node's fields, field_project_id. If I use a literal for the third argument, it works. If I try to ...
timwilson's user avatar
5 votes
1 answer
1k views

Cannot import Paragraph based Feature into new site

Perhaps someone with a bit more Features expertise can help me here. I have a Drupal site with 25 or so Paragraph types that I would like to export (one by one) to its own contained Feature. I ...
Kevin's user avatar
  • 27.8k
5 votes
2 answers
427 views

Migration of content with an UI

My goal is to import data of customers from a csv file to my custom entity. For that I wrote a migration with the migrate_source_csv module as source plugin. This works fine, but the problem is, that ...
Chris4783's user avatar
  • 1,083
4 votes
1 answer
649 views

How do I migrate paragraph translations?

So I am trying to migrate paragraphs from Drupal 7 to Drupal 8. I have created 3 yaml for the same and execute them in below order: Paragraph YAML (migrate_plus.migration.paragraph_latest_story.yml) ...
Subhash's user avatar
  • 93
4 votes
0 answers
259 views

Which is a better practice in Drupal 8 to get field value from an entity?

I have a product variation entity from which I need to retrieve SKU value. I am able to get the value from the below lines, but I want to know which is a better practice and why. $entity->getSKU();...
Vishnu Vijaykumar's user avatar
4 votes
1 answer
1k views

How to implement StackMiddleware for a redirection correctly?

I'm working on a redirection (for unauthenticated users) for my Drupal 8 site. Currently, the redirection works however, the redirection persists even after user is authenticated. I found this article ...
Joe Spinelli's user avatar
4 votes
0 answers
683 views

How to use inline entity form field in custom form?

I have a site with Drupal 8 and Commerce 2. Now trying to build a custom "Create new order" -form for admin. Created a custom module and form with buildForm() function. Managed to add selection for ...
SPR's user avatar
  • 83
4 votes
0 answers
1k views

How do I conditionally change the value of a field depending on the value chosen in another?

This was so easy in webform 4.x. However, I cannot seem to find it in webform 5.x. I am creating a form using webform 5.1, and I need to set the value of the fees for a particular grade for an ...
Jasper Levi's user avatar
4 votes
0 answers
1k views

How to add 'Set-cookie' header on rest POST response

I have subdomain front.test.local as frontend ngx-app and another subdomain back.test.local for the backend pure Drupal both on https - cookie-domain is set to '.test.local'. I need cookie because ...
svetlio's user avatar
  • 1,504
4 votes
1 answer
760 views

How to get attachments out of a twig file

How do I get the attachments out a twig file and add them to a build array? If there is a twig file with {{ attach_library('mytheme/pullquote') }} And because it's in an ajax response, I need to ...
oknate's user avatar
  • 14.3k
4 votes
0 answers
2k views

Difference between service and plugin?

After have read some link i'm still confused about the difference between service and plugin. I am not speaking about plugin like block or Field formater etc... i would like to take an example : I ...
Kevin's user avatar
  • 2,556
4 votes
0 answers
283 views

How to use Context with Views' Contextual Filters

I have content type City. I have a view page with contextual filters to show the cities at the URL pattern locations/<city id>. I want to use Context to add blocks to these cities pages but I ...
Jeff's user avatar
  • 283
4 votes
0 answers
462 views

What is the way to restrict access to a store and its products by user?

I'm using Commerce 2 and I have: User A and User B Store X assigned to User A (by entity reference) Store Y assigned to User B I would like to restrict access to products of stores so that User A ...
Sinan Erdem's user avatar
4 votes
0 answers
459 views

Image styles are not generated in Docker for Windows

When I open in browser http://localhost:1567/sites/default/files/styles/thumbnail/public/2017-10/478069720_1384178114_4.jpg, I see 404. The "original" images are uploaded successfully, and the ...
milkovsky's user avatar
  • 5,334
4 votes
0 answers
3k views

How to setup Swift Mailer to send mails using SMTP server and TLS encryption?

I'm trying to send Drupal 8 emails using Swift Mailer (5.4.8, 8.x-1.0-beta1) and a remote SMTP server. The transport should be encrypted, so TLS should be used. This is my setting: Unfortunatly when ...
Philipp Michael's user avatar
4 votes
0 answers
191 views

Can't make sense of the CSS loading order

I want bootstrap.css to load first, because it's breaking all of my styles. Yet, no matter what settings I use in my module, it always loads last. Every CSS file from a library in my theme loads ...
RaisinBranCrunch's user avatar
4 votes
0 answers
530 views

Front page without language prefix

I have a multilingual site on Drupal 8 migrated from Drupal 7. It has URL language detection method. Default language is English, it has path prefix /en. With this configuration front page is ...
kovtunos's user avatar
4 votes
0 answers
3k views

"DISTINCT" in Views not applying?

I am trying to add DISTINCT to a view, and for example I chose the default content view. I expect that it would add DISTINCT(id), but the query does not change at all. Why is it not added? Update: ...
Kevin's user avatar
  • 27.8k
4 votes
1 answer
426 views

Migrate taxonomy with depth

I need to migrate a CSV file of 3000 Taxonomy terms with depth of 5 levels deep. This is a small sample of the CSV comma-separated values file. About Us About Us, Our Programs About Us, Our History, ...
paul cappucci's user avatar
4 votes
0 answers
366 views

Is ContentEntityBase::access affected by hook_ENTITY_TYPE_access?

Are calls to the access() method on entity objects which is provided by ContentEntityBase affected by hook_ENTITY_TYPE_access()? I am asking because the Paragraphs module, in src/...
ummdorian's user avatar
  • 517
4 votes
0 answers
1k views

Why are the thumbnail images not loading?

I am using Drupal 8, and have just moved my site to shared hosting. When I upload a standard image field on my shared hosting environment, the thumbnail image does not show up. This works perfectly on ...
mike421's user avatar
  • 41
4 votes
1 answer
715 views

Custom views filter on computed field

I've built a custom field into the view which displays the menu name a node is assigned to, but I want to filter on the menu name. How can you filter on this computed field? The only examples I have ...
Dylan Spencer James's user avatar
4 votes
0 answers
319 views

How to hide a menu item of a view for an administrator?

I have created a view with Views and restricted the access by Role. I also created a menu with the view, and I didn't select the Administrator role to be included (so Administrator role does not have ...
usethe23's user avatar
  • 651
4 votes
2 answers
1k views

How do I remove JOIN in hook_views_query_alter()?

I have a view with two filters (A + B). Filter B should only be included in the query, if a specific value in filter A is set (like a "conditional filter"). So I tried to remove the where condition ...
Philipp Michael's user avatar
4 votes
1 answer
105 views

Why is my functional test not matching my manual testing?

I have a Drupal 8 module for banning users based on country. In it, I have the following test. public function setUp() { parent::setUp(); $this->drupalLogin($this->adminSitesUser); } public ...
Webdrips's user avatar
  • 742
4 votes
1 answer
1k views

Action links available options / caching

I have some action links defined in module.links.actions.yml which uses a custom "create entity" route. For entity creation I set up some restrictions and at some point the access is denied. The ...
Marius Ilie's user avatar
  • 3,072
4 votes
1 answer
981 views

How to fix "Unable to save a field collection item without a valid reference to a host entity" error?

I programmatically created a series of custom content entities which contain field collections. My site had an execution timeout error in the middle of entity creation and saving. I can not delete ...
saramm1's user avatar
  • 727
4 votes
0 answers
419 views

How to create additional base fields for ECK entity

For example I want to create a Vehicle ECK base type and Car and Truck bundles, but I want to define fields for the Vehicle base type that would be shared between Car and Truck. In UI, by default, I'...
Trupal's user avatar
  • 513
4 votes
0 answers
1k views

Loading a form in dialog/modal returns an error

I have a form with a submit button binded to an AJAX callback that opens up a modal with another AJAX form. The modal dialog opens with the form, but the AJAX submit in that modal form isn't ...
edwardchiapet's user avatar
4 votes
1 answer
2k views

How do I index custom fields with the search API using elasticsearch?

I see all kinds of tutorials to get apache to index content. Is there any difference in getting elasticsearch to index my new custom field? On the field page I can see my field but when i expand it ...
BrandenB171's user avatar
  • 1,112
4 votes
1 answer
972 views

Prevent dual submit on form submission

I've got a form that submits via AJAX and in the callback I need to rebuild certain parts of the page to reflect the newly submitted data. One of these parts is the form, which I need to clear all ...
Lyndon Cox's user avatar
4 votes
0 answers
3k views

How can I rename uploaded files?

Using Drupal 8, I want to rename and clean all the uploaded filenames. I want to convert all the spaces to dashes and make all the characters lowercase. A file named Screen Shot 2016-03-29 at 1.13.21 ...
otarza's user avatar
  • 954
4 votes
1 answer
469 views

Failure getting nodes from terms via the rest api

I have added a REST web service in Drupal and all content is tagged with taxonomy. I'm now trying to acquire all related nodes to the terms. First I'm calling taxonomy_vocabulary/getTree along with ...
David Wiktorsson's user avatar

1
2 3 4 5
82