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
-4
votes
0answers
24 views

How to add custom style sheet to PDF output

I have used addtoany module in which print option is there. If I click on print pdf is generated. I want to theme that pdf.
-1
votes
1answer
20 views

How to configure the gzip compressor for JSON response? [duplicate]

I am implementing REST resource endpoints to expose drupal content. Request to fetch this content is accepting gzip compressor but in response headers, this is not available. I confirmed whether ...
0
votes
1answer
25 views

How to include media documents in search

Is there any way to include documents I created with the media core module into the search form of the page? I only found the categories "users" and "nodes".
0
votes
2answers
28 views

Delete node references for some content types only

Unless there's a method I'm unaware of, node references are not related to their node's content type. I need to delete referenced nodes when the target ids are not of a certain content type. Here's my ...
0
votes
1answer
33 views

JSON API Filter by URL path

I am implementing a headless drupal website with json:api as the gateway to get all the data. I am able to get data by their node ids, but that is only if I knew the node id and type beforehand. Is ...
0
votes
2answers
64 views

With a WSOD upon deployment of a site, should I first clear the cache, check watchdog logs, or check the Apache logs?

With a WSOD upon deployment of a Drupal 8 site, should I first clear the cache, check watchdog logs, check the Apache logs, or something else? I read the Drupal WSOD triage information here But it ...
0
votes
1answer
22 views

How do I send an email from a module using an Easy Email module email template?

I am creating a form that needs to send an email upon form submission. I want to use the Easy Email module to send HTML emails. I want to send an email from my module, using an Easy Email template. ...
0
votes
0answers
37 views

Not able to load data from cookies until I clear cache [duplicate]

In my Drupal application, I have set some cookies through a javascript onClick method. However, am not able to access the data until I clear the cache(admin/config/development/performance/clear ...
0
votes
1answer
23 views

Generate new bearer token with simple_oauth programmatically?

I have a custom service and in the custom service, I want to generate a new Bearer token for the current user ( it's logged in) with simple_oauth module. in its documentation is has not mentioned how ...
-2
votes
0answers
31 views

Random scroll jump after AJAX request

I have a problem with an Ajax view. I have a SearchAPI Block and whenever I change the filters the block reloads and the page scroll jumps randomly. This problem does only appear when the page is ...
0
votes
0answers
43 views

How can I redirect to a particular page or front page after login via a social networking site?

In my Drupal 8 site, In the comment section, I have one button ("Add new comment"). Clicking on it will open a login pop up and user will be redirected to the same page. For that, I added the ...
0
votes
1answer
20 views

Database error with migration

I am trying to migrate users and a few other entities from a Drupal 7 site to Drupal 8 with the built-in migration modules and Migrate Plus. I have added a database array in settings.php but ...
0
votes
1answer
19 views

Add custom orderBy in ViewsSort plugin

I'm attempting to sort the results of a View by matching one of the Entity IDs in the result set to the referring URL Entity ID. I'm trying to do this in a custom Views Sort plugin. I did some ...
0
votes
0answers
48 views

Database Rollback Transaction?

I have a multi database site, when I save my content type it is added in both the Laravel side database and the default Drupal database. Now most of my code is in try catch and it does not save data ...
0
votes
1answer
21 views

How do I define the default cache and cache settings programmically in a Kernel test?

A user provided a set of site caching configuration settings that cause some errors. For example: $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.memcache'; $settings['cache']['bins'...
0
votes
0answers
15 views

How to access entity id in view of custom entity revisions?

Edit: it has since appeared, but I don't know how I did it! I have created a view of revisions of a custom entity type. I would like to group them by entity ID. But I don't see the entity ID ...
0
votes
0answers
13 views

How to send emails locally from Acquia dev desktop

I want to send test emails locally. I am using Acquia dev desktop for local env. Drupal core-8.1.8 php-7.0.32 I tried using Smtp Authentication Support module with Mail system, Swift mailer with mail ...
1
vote
1answer
61 views

Major module update with Composer

I have some modules in 8.8.5 that need an major update. What is the best practice without loosing data or settings? For example: drupal/admin_toolbar 1.27.0 2.2.0 Do I need to ...
0
votes
0answers
33 views

hook_node_access_records() or similar hook for a view

I need to create a permission system using a node reference field. In this scenario nodes are products and users are printers. Site administrators can assign printers to each product and printers can ...
0
votes
2answers
48 views

How to access webform field labels in a twig template?

The YAML below represents a webform. Theming is simple using the twig template also found below, but the label for email is inline with the input field by default. How can the labels in the webform be ...
2
votes
1answer
47 views

How can I remove all contextual links except in layout builder?

When using the layout builder module, the contextual links module is a hard dependency. This works quite well in the context of the layout builder. But I don't want those links anywhere else, because ...
0
votes
0answers
7 views

Saving the response of an Ajax callback of an element in a custom FieldWidget plugin

I have created a Field widget for Text fields in a content type. If a URL is entered into the text field, an ajax event callback is triggered on change and the URL is parsed to fetch the Open Graph ...
0
votes
0answers
20 views

How to programmatically access custom block's field data? [duplicate]

I need to access the value of the fields field_lb_text and field_lb_glossary, can someone explain me how to go about with this? Thus far I have tried this, function theme_preprocess_block(&$...
1
vote
1answer
45 views

Semver, core_version_requirement and update hooks

I have read a little bit about using semver for contrib modules in the updated documentation Transitioning from 8.x-* to semantic versioning and Drupal.org release version numbers allow semantic ...
0
votes
0answers
19 views

Exposed filter override a textfield with a select field works only once

I have a code which works for using the title of a field as exposed filter select but it works only for the first time it is used afterwards (and because of ajax) it goes back to the state of field ...
-1
votes
0answers
86 views

Illegal length modifier specified

I started getting this error when I try to load admin pages: Fatal error: Illegal length modifier specified 'f' in s[np]printf call in /home/mypath/public_html/mysite.com/core/lib/Drupal/Component/...
0
votes
0answers
20 views

Access plugin to determine access by contextual filter value, no caching

I want to create a view access plugin that determines access based on a the value passed to a contextual filter, and as a consequence, I don't want the value returned from access() to be cached. I ...
0
votes
0answers
20 views

Set datetime field without end value

I have a multiple value datetime field with start and end date. I've tried to update the field value with an start date without ending date but a php error happens. Any ideas to solve this? Code: $...
0
votes
0answers
21 views

What is the ':input[name=???]' of a subform field?

and thank you for your contribution. I have created a custom content type with a field (field_table_2) that is a (list of) paragraph element reference entity. The paragraph entity, contains 'select' ...
-2
votes
0answers
27 views

How do I install the OAuth2 Server module?

I attempted to install the module OAuth2 Sever for drupal 8 and it just broke my website and now only a blank screen appears. Here is my environment: Drupal 8.8.5 PHP 7.3.8 I downloaded the ...
1
vote
0answers
33 views

Is it possible to use libraries-extend from a module (instead of theme)?

Problem/Motivation I'm interested in altering/overriding the little bit of HTML markup that's output by core, in my case Drupal.theme.mediaEmbedEditButton (from core/modules/media/js/...
0
votes
1answer
36 views

Replace \Drupal::service with Dependency injection in FieldWidget class

I have created an ajax callback inside a custom Field Widget plugin. In the Ajax callback I have called a custom service using $service = \Drupal::service('service.name') I am using phpmd to clean ...
0
votes
0answers
13 views

How to alter file remove button html or attributes?

Default file widget functionality. File is uploaded, remove button is added to the page as well. I'm sure that code is running because i'm able to debug it upon ajax upload. Still no new class, no ...
-1
votes
1answer
22 views

ckeditor don't preview picture tag [closed]

i'm working on drupal 8 and i'm using picture instead of imag tags. To take the benefit of the responsivness feature. I'm just facing and issue that CKeditor can't preview the pisture tag. Any idea ...
0
votes
0answers
32 views

How to set headers in REST API endpoints for GET method?

I am writing Rest api end point for GET method and testing the same in postman client. By default there is no Header for encoding technique called utf-8. I want to send it in Response headers manually....
1
vote
1answer
37 views

How to alter page content?

Simple thing. I have some page (node). At end it produces some content, i.e. <h1>This is original content</h1> I want to alter it with different content, i.e. <h1>This is changed ...
0
votes
1answer
10 views

Get enabled content types machine name

I'm trying to get the enabled content type machine names for a given group. I wrote the following code, but to get the machine name I should cut the strings to group_node:. /** @var \Drupal\...
-1
votes
1answer
22 views

How to automatically install an image in taxonomy term field every time I install the module

I have a module with a custom taxonomy term called colors. The Colors taxonomy has 1 image field where I can upload a file based on the color names. I wanted the images to be automatically installed ...
2
votes
1answer
35 views

What operator is equivalent to “Is not greater than or equal to”?

I have a view showing a list of events. The events are sorted by a date field, which a user can use to input the event starting date/time. However, I want the events removed from the list once the ...
0
votes
0answers
22 views

how to display a media description in a twig template?

i want to display the media description available in the file field of a media ( media of type video, audio, image, etc...), it is an option to activate: Enable Description field The ...
0
votes
0answers
17 views

Adding content throws query exception after upgrading

I have a Drupal 7 site I am upgrading to Drupal 8. After running the upgrade process on a fresh installation of Drupal 8, all content seems to be imported correctly. However when I try to add or edit ...
0
votes
0answers
21 views

Local install, access denied

This is a local install of Drupal 8.8.1 I have setup for learning drupal dev. I have my route file setup like so, the controller just returns a paginated list: mymodule.configurations: path: '/...
0
votes
1answer
22 views

Contextual filter by node reference ID

Since good 10 years I work with Views in Drupal. Seems I am just to stupid to get it :) I tried really every combination but I am not able to put out a working block view with articles, which are ...
-1
votes
1answer
22 views

SimpleSAML_php authentication from 8.x-3.0 to 8.x-3.2 results in error

I updated SimpleSAML_php authentication from 8.x-3.0 to 8.x-3.2. Since then, whenever I click on the SSO login button, I get this error. Exception: Could not resolve 'saml:SP': no class named '...
0
votes
1answer
31 views

Programmatically set the value of a multi-value field from multiple arrays

I have 3 taxonomy vocabularies: Fruits Vegetables Drinks On the Article content type, I have set a multi-value entity reference field field_article_all_items referencing all of Fruits, Vegetables ...
0
votes
1answer
34 views

How can I write into a Flag's custom field programmatically?

I successfully managed to save a flag programmatically in Drupal 8 thanks to this help but I cannot manage to save data into a custom field I added to the flag entity. The following code saves the ...
-2
votes
2answers
29 views

How can we check the emptiness of field value without increasing the Cyclomatic and NPath complexity? [closed]

I am working on Rest api end points for different content types. I am using normalizers for the same, but when i'm trying to make use of same normalizer for all content type, conditions in the ...
2
votes
1answer
33 views

Download D7 module using Composer for D8?

I'm using Drush 10, and I can't use dl to download a module, since the command was removed to push Composer use. Is there a way for me to download a Drupal 7 module into a Drupal 8 site using Composer,...
2
votes
1answer
45 views

Does requiring core/drupal load jQuery in custom script files?

I am trying to understand a bit more about where and how jQuery is loaded in Drupal 8. If I write a custom script file that will include some translation strings using Drupal.t(), I need to add core/...
0
votes
0answers
13 views

Views aggregation is turning my date field to integer

Edit: This is a duplicate of Maximum on date field and Views aggregation issue. I've made a view using aggregation on a date field (revision created date). I want to show the minimum date for a group ...