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
4 views

Rule to redirect if user has role

I am trying to create a simple redirect rule using the rules module if the user has a certain role, in my case investor. This is how I set up my rule I installed the rules module I have a user who ...
1
vote
1answer
869 views

How to setup external CSS and JS to prevent render-blocking from Google PageSpeed?

We are using Google's PageSpeed to help optimize the site. A couple constant issues that come up include render blocking CSS and JS. We have tried the following in our libraries.xml file, but cannot ...
0
votes
0answers
5 views

Dynamically remove library based on user role, cache context not working

I want to remove all libraries of modules & themes, except those from modules/themes that are defined by me. This should only be done for anonymous users. All libraries should be served to ...
0
votes
1answer
28 views

Can't seem to load CSS in a custom theme

I'm working on trying to add CSS to a custom theme, and it seems my logic is failing somewhere. I'm adding simple css files in the .libraries.yml on the root of the theme (only thing in them right ...
0
votes
0answers
15 views

Hostname for CSS and JS Aggregation

We would like to place the aggregated CSS and JS onto a CDN as static resources. To accomplish this we need to load these resources with a special hostname. Let's say the base url of the website is ...
2
votes
2answers
111 views

What is the correct way to exclude certain CSS files for anonymous, but include for authenticated users? [duplicate]

We have a subtheme, mytheme that is based off of the classy base theme. We have set Aggregate CSS Files = true and when the pages load we end up with many aggregated CSS files. One issue is that we ...
-3
votes
0answers
12 views

.js conflict after start session drupal 8 [on hold]

In Drupal 8, I have configured \Drupal::request()->getSession(); then start session, but my .js files are conflicted. When I start session then it's automatically added some .js links, so after ...
0
votes
1answer
22 views

How do I remove a module JavaScript file through a theme?

I need to remove a JavaScript file added from a module through a theme. How can I achieve this?
-3
votes
0answers
13 views

Comments on Paragraphs functionality [on hold]

I'm currently working on a Drupal 8 project. And I phase some challenge. I want to use Paragraphs as multiple body fields. Each paragraph should have its own comments. And each comment has like/...
0
votes
2answers
46 views

How do I remove the term ID from the view URL?

I have a content view with an exposed filter based on a vocabulary. In the URL (for example, mysite/myview?tid=taxonomy+term+(3)), and incidentally in my page title (I use argument.tid to display a ...
0
votes
1answer
438 views

how to pass loop.index from view to node

In a views template (views-view-unformatted.twig.html), I have {% for row in rows %} {% set row_index = loop.index0 %} {{ row.content }} {% endfor %} where each row is processed in ...
0
votes
1answer
28 views

Trouble installing drupal-project with Composer

I have followed the directions to install drupal-project with drupal-composer. I keep getting this error and it doesn't make sense to me. [InvalidArgumentException] Could not find package drupal-...
0
votes
2answers
390 views

Can't get Flagging API to accept POST request

trying to use the REST API that comes with the flagging module on Drupal 8. I've enabled and secured the endpoint that comes with the module: /entity/flagging: POST I'm nearly there, but following ...
0
votes
0answers
10 views

Strange Migration Errors

Really bizarre Drupal problem making me unable to use Drush to check migrations. With Migrate Tools enabled I get the following error: PHP Fatal error: Trait 'Drupal\content_translation\Plugin\...
-2
votes
0answers
29 views

Empty node in content type after migrate from d6 to d8? [on hold]

After migrating node type with drush migrate-import d6_node:chassis --update, It show error drupal-8\core\lib\Drupal\Core\Database\Connection.php:683 SQLSTATE[23000]: Integrity constraint violation: ...
0
votes
0answers
52 views

Error on drush command: In ThemeHandler.php The theme does not exist

I manage to broke the default theme in development and now could not access the administration interface nor could I change the theme via drush. The way I broke the default theme is by changing the ...
1
vote
2answers
436 views

Add cache context to altered links

I am using hook_link_alter(&$variables) to alter links depending on the user's role. I'm doing this for links in the main menu as well as for custom links shown on entities. This works good except ...
0
votes
1answer
18 views

Permission for private file to anonymous

I have an ad content type, with a file field that is in a private directory when saving the node. Ads and their files are only accesible for authenticated users. I wish I could allow anonymous users ...
0
votes
1answer
24 views

Pass hidden fields using drupalSettings to Twig template

We have a paragraph field (field_pr_custom) on the Basic page content type that has a custom twig template, pr-custom.html.twig. In the twig template, we need to pass in an array inside of a <...
0
votes
0answers
24 views

Successful Drupal Application Architectures & Patterns [on hold]

I maintain a Drupal 8 instance for a large community college. Increasingly, my audience is asking for various applications to be built using Drupal as the development platform. While this is a ...
0
votes
0answers
17 views

Migrating multi-lingual wordpress site

I need to migrate my multi-lingual wordpress site to Drupal 8. I have posts and pages translated in other languages and every post/ page have different post id. How can I migrate these translated ...
1
vote
1answer
19 views

Check if user_picture value is changed or compare with old value

I am trying to find if a field value is changed or updated by the user. But there are blockers. function custom_form_process_user_picture(&$form, FormStateInterface &$form_state) { $...
0
votes
2answers
37 views

Using “if statements” to add classes in Twig

I'm attempting to use an if statement to determine the value of a field and print a class based on that value. I'm not getting any errors, but the addClass is not working. No classes are being added. ...
3
votes
3answers
1k views

Regenerate image styles

I'm currently using Drupal 8.2.3 for my website design. My aim is to use it for publishing my blogs to social media sites, such as Facebook, Twitter, LinkedIN, etc. With that in mind, i'm using image ...
0
votes
0answers
18 views

How to grab taxonomy term with node_presave hook

So I'm running a hook to update the title with values from the node whenever the node saves. I want to update part of it with a taxonomy term but when I try to get the term from the entity it says it ...
-2
votes
0answers
18 views

Comment form on Ajax loaded node view does not work

I am loading node view content using a custom route via ajax (in Drupal 8). Content loads correctly and comment form also shows correctly but when I try to submit the form, it redirects to node view ...
-2
votes
0answers
28 views

How to fix SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded on multiple POST requests via JSONAPI module?

I have a custom Drupal 8 module which includes React app. When making multiple POST requests using JSONAPI module to create new nodes in Drupal from the app, the first request passes well, but others ...
1
vote
1answer
433 views

Print admin toolbar icon in custom module

How can I print the admin toolbar icon for my module? I created a module and it has a menu in the admin toolbar. I want to show an icon (module/costum_module/image/00/icon.svg) in this path for my ...
-3
votes
1answer
32 views

How do I clear the cache for a custom block?

I have custom block holiday this block is not updating once I'm updating data in database when I'm clearing the cache block is working. Is there any solution for this cache issue? I'm attaching the ...
0
votes
1answer
24 views

Notify a user if a node has a comment or status updated

I'm trying to build a simple ticketing system with Drupal 8.6. I'm able to create a content type for these tickets and the comments will be the responses to the ticket. Also I have a status field for ...
0
votes
1answer
433 views

Geolocation Click Marker Event

I'm using a Geolocation Fields View with Drupal 8 and need to manipulate the Style of the Marker Info Window. there is no class to style the pop-Up-window for the Info Text. The Info Text has a class ...
0
votes
0answers
20 views

Prepopulate additional instances of a multivalue text field based on another existing text field?

Consider the following (newly created) form: field_country (option select) field_phonenumber number (multivalue text field) When the user chooses from field_country, then the user can add unlimited ...
1
vote
1answer
433 views

Get node internal path from path alias in Twig template

I want to get the internal path of a node from its path alias. In Drupal 7 we could use drupal_get_normal_path() directly in the PHP template. With Drupal 8, Is there a function to get the internal ...
0
votes
1answer
12 views

Use 'Search Api Attachments' file extractor in my own custom 'Search Api' processor plugin

I'm writing a custom processor for search api that will search body content of nodes for links to pdfs and extract the content from them to be indexed. It's meant to be able to do the same thing ...
0
votes
0answers
10 views

How do I troubleshoot a node not appearing in wokbench?

I have a bug report where a user is not able to see 'Draft' status nodes that they have just created in their workbench interface (at /admin/workbench). They are able to see other nodes in various ...
0
votes
0answers
26 views

Add custom ajax command to ajax response after webform is submitted

What I'm trying to do is to invoke some javascript after a webform is successfully submitted by ajax. To do that I followed this advice and created an EventSubscriber to intercept ajax response and ...
0
votes
1answer
448 views

Adding custom data to the node object

I have created a content type called providers and when editting said content types users can fill in extra information related to the content. I have included said form fields using hook_form_alter,...
2
votes
1answer
22 views

Generate installed modules into a composer.json for existing site: I need to manage via Composer, not via UI

I have a Drupal 8 site up and running with modules that were manually installed. I want to generate an appropriate composer.json file to manage these using Composer. The closest I could find to ...
0
votes
0answers
10 views

How do I handle “group by” for values in multiple groups

In Drupal 8, using the Views module, I have values of Content type "X" grouped by a 'category' field. Everything worked fine until I was forced to apply two groups to one of the values. In my example, ...
0
votes
1answer
18 views

Validating a node body

hello i am trying to validate the content of the node body for certain text having some trouble with it. it outputs an message "array". function test_form_alter(&$form, FormStateInterface $...
0
votes
2answers
47 views

Add external CSS file with custom backend setting

I'm trying to add a external CSS file. The client wants to be able to change the url from the backend. Creating a backend settings form is not an issue, but I can't seem to get the file loaded in the ...
0
votes
2answers
434 views

Registration form in popup in drupal 8

I have to show log in and registration form in popup in drupal 8 website. I had check for module but I did not find any module. can anyone help me ?
2
votes
2answers
797 views

Change the default language of a node

Given that I have a node in English as default language and Danish as a translation, is it possible to set the Danish translation as default language for the node?
0
votes
1answer
462 views

Create menu link for authenticated user programatically

So here is what I've tried in custom module dir I've created module.links.menu.yml file here is code. I want to just for authenticated user beside Content link have my custom link to access Webform. ...
0
votes
0answers
26 views

What is the correct way to send a node list to the REST API?

In Drupal, we can create nodes with the core module "RESTful Web Services". There is a lot of documentation about creating one node with one request, the Drupal documentation provides the following ...
2
votes
0answers
29 views

How do I programmatically change the node default language?

I have a node already translated in 3 languages (en, fr, es) with en being the default language. and I want to change it to fr. I looked around and I found setDefaultLangcode() (protected). Is there ...
3
votes
0answers
237 views

Filter by taxonomy parent using Json api

In drupal 8.5 I have a taxonomy term list like this: Term A (12 items) Term 1 (3 items) Term 2 (8 items) Term 3 (1 items) Term B (3 items) Term 4 (1 items) Term 5 (2 items) I want to use ...
8
votes
4answers
3k views

How to get all node entities tagged with a specific term?

For a given taxonomy term in D8, is there any API function/method that returns all node entities that reference it?
1
vote
2answers
126 views

Drupal 8, error on order view page

I'm working on a Drupal 8 / Drupal Commerce website, and I run into "Website encountered unexpected error" when trying to access /admin/commerce/orders/* pages (order view page). In log messages I ...
0
votes
0answers
26 views

is getString() returning translated content?

$links['node']['#links']['node-readmore']['attributes']['title'] = $entity->field_anc_label->getString(); I am using getString() value , need to know whether its translated or we need to call ...