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
0 answers
38 views

How to make entity query condition field case insensitive to compared value

I am writing an entity query as below $entity_query = \Drupal::entityQuery('node'); $entities = $entity_query->condition('my_field', 'some data', 'LIKE') ->condition('another_field', ...
user avatar
0 votes
0 answers
13 views

How to make custom Views filter plugin dependent on the values of anotherr filter value?

I have created a custom Views filter plugin that filters the node according to nid. This is available as a dropdown plugin. There is another custom Views filter available as dropdown. The value of the ...
user avatar
  • 804
-1 votes
1 answer
23 views

REST cookie authentication, Post 403

I am logged in to my Drupal account and if I use the jQuery code from here then I can make a post request to my site and create a node. But if I try from another site, like my local host or a third ...
user avatar
0 votes
1 answer
21 views

Anonymous users can edit all anonymous users content

Drupal has a edit own content permission for each content type. I have given the Article: edit own content to anonymous users and discovered that Drupal doesn't differentiate between different ...
user avatar
1 vote
0 answers
27 views

Multiple value field create duplicate results when using leftJoin

I have a query to the database for a specific content type. Everything is working as expected but when I add a leftJoin query on the field 'node__field_country' which is a taxonomy term reference ...
user avatar
0 votes
1 answer
37 views

cant get file uri using field preprocess

Im trying to use function theme_preprocess_field to get the file path of a file field. I have tried different variations of below. function mytheme_preprocess_field(&$variables) { if ($...
user avatar
0 votes
1 answer
22 views

Image styles - How to resize uploaded images and force an aspect ratio

I'm looking for a solution to resize uploaded images while maintaining a desired aspect ratio instead of cropping them. We can configure some preset Image styles, but it seems we can only : Resize : ...
user avatar
0 votes
0 answers
15 views

Pull value from a node field based on another field

I want to be able to update the value of a field based on taxonomy term. I have a term (location) with a custom field (country) and city with corresponding values in this term. I create a reference ...
user avatar
  • 1
1 vote
0 answers
8 views

RESTful web services custom reponse when creating nodes?

I have enabled RESTful Web Services and REST UI. I have followed the guide in this answer and am able to create nodes using the REST api. https://drupal.stackexchange.com/a/256429/105808 However, when ...
user avatar
0 votes
1 answer
37 views

Get all parent term taxonomy id and name of vocabulary

I have a vocabulary (Vehicle) which contains the following taxonomy terms. Maruti Alto Swift Baleno Barazza Hundai I10 I20 Creta Tata Nexon Safari Nano I want to get only the parent taxonomy ...
user avatar
  • 9
0 votes
1 answer
21 views

How to generate templates suggestion for media.html.twig for a specific field in a content type?

I have a content type (say Article) with an entity reference field to another content type (Author). I have used layout builder together with a view mode to display the content of the Author field in ...
user avatar
  • 804
-1 votes
0 answers
25 views

Drupal.t() not working well

I try to translate some labes in JS in user interface language with the function Drupal.t() but it's not working even when i add in dependencies:{ - core/drupal - core/jquery } and clear all caches
user avatar
0 votes
0 answers
9 views

Credit card month & year automatic migration

I am using Braintree with Drupal 8 and need for the user to be able to go from the 'Month' to the 'Year' field automatically when typing without having to manually place their cursor in the 'Year' ...
user avatar
0 votes
0 answers
12 views

Adjust total price in commerce checkout

I have a store setup with 2 products. Public and private tours. Public tours are 10 for each unit. Private tours on the other hand are only meant to collect a deposit. I need the total to be $50 no ...
user avatar
  • 407
1 vote
1 answer
33 views

Link in URL field to Media File

Before the Update to the latest DruPal 8, we were able to link to public://foo/bar.pdf to a file which was in /sites/default/files/. No the public:// prefix does not work anymore in the URL input ...
user avatar
  • 87
1 vote
1 answer
55 views

How to update taxonomy field with array of terms?

I am having a body like this { "userid": 435, "territories_id":[176,139] } Where userid is the drupal user id. And I need to update field field_user_territory which is a ...
user avatar
  • 437
0 votes
0 answers
52 views

How to get PHP code into a Views Filter

I have a text field which is extracted from photo's EXIF value; its value is similar to 2021-05-31T15:15:05. I want to create a view, use the filter and get the field added in. However, I can't use ...
user avatar
0 votes
2 answers
20 views

How do I print an exposed filter block in a template file?

I have a view with an exposed taxonomy filter. I configured it to be displayed as a separate block so that I can print it another twig template. I tried this. /** * Implements hook_preprocess_block() ...
user avatar
  • 804
2 votes
1 answer
78 views

Can I know what I'm looking at from the URL?

I think on Drupal 7 I had previously used something like menu_get_object() to find out what content I was on. For example, with mysite.com/content/my-page, it would tell me that this was a node, its ...
user avatar
-2 votes
1 answer
20 views

When editing a node, tab group titles are missing [closed]

When editing a node, tab group titles are missing: The HTML looks like this: <ul class="horizontal-tabs-list"> <li class="horizontal-tab-button horizontal-tab-button-0 ...
user avatar
  • 87
1 vote
0 answers
29 views

Sending data to custom block [closed]

I created a module that has several pages of administration. One of these pages is a block creation page. When the block is created the name of the block is kept in the database. The block build() ...
user avatar
  • 11
3 votes
1 answer
24 views

Selective cancellation from Watchdog

Can I selectively DELETE rows from watchdog? I have annoying errors and warnings I'm slowly getting rid of, but I would like to keep the history of user actions (create, update and delete on content). ...
user avatar
0 votes
1 answer
56 views

Generate Link based on custom content field types

I am using Drupal 8.9.8 and I have created a custom content type with field types such as plain text, number (integer), and so on. Then, I created Content based on the custom content types and filled ...
user avatar
1 vote
1 answer
42 views

Meta content type

Drupal core allows creating content types. I wish to have several different content types, all with the same structure. For example: Food Italian food Sicilian food Each content type would share the ...
2 votes
1 answer
49 views

Disable a field if another field is disabled

I need to disable field A if field B is disabled too. Actually, my current field A has the following #states (altered using hook_alter_form) to disable it if field B or field C are empty: /** * ...
user avatar
0 votes
1 answer
25 views

Entity agnostic way of retrieving title

Is there a way of the Title/Label/Name of an unknown entity type via 1 method? At the moment if it's a node, I have to use $entity->getTitle(), for a user it's $entity->getAccountName(), for a ...
user avatar
0 votes
1 answer
15 views

Comparing 'old' values in hook_user_update

I've got a function which is running on hook_ENTITY_TYPE_update for the user account, but I want to be able to compare against previous values that may have been on the user account, eg see if the ...
user avatar
1 vote
1 answer
18 views

Adding sequence item to configuration

I have a configuration item in my custom module, part of which is a sequence, basically I'm attempting to create something akin to an array of items my_module.schema.yml my_module.settings: type: ...
user avatar
0 votes
1 answer
42 views

Programmatically add value to multi-valued/repeater field at weight/index

In Drupal 8, I have a content type and more than a few nodes that have a Paragraph field with unlimited number of values, and so I need to programmatically add a paragraph at an index to the existing ...
user avatar
  • 13
0 votes
1 answer
54 views

How to add a submission handler to a form class on Drupal 8?

I would like to add a submission handler to my form class so that the submitted values are saved. The parent class does not save them but only displays a message. I use Drupal 8! Here is my form class:...
user avatar
0 votes
0 answers
73 views

Upstream timed out (110: Connection timed out)

I installed opigno_lms 8.x-2.9, I created a training and want to publish it. When I click "Publish", the site try to load for 60 seconds and then get "Error 504: Gateway time-out". ...
user avatar
0 votes
0 answers
20 views

How to persist webform validation result in multistep ajax webform handler?

In my AJAX form the user has to do a validation as he needs a code to enter the rest of the form (it has 3 pages or more). I have an handler to validate this and this same handler uses that code to do ...
user avatar
1 vote
1 answer
84 views

What is the correct way to get the rendered fields values in a block view twig template?

I have a block on the main page of my website that displays most recent news stories from the News page (3 latest entries). This is a view, here is its settings: I'm trying to make this block look ...
user avatar
0 votes
0 answers
22 views

Load original email content via hook_mail_alter()

I'm hooking into hook_mail_alter() to make an amendment to outgoing emails before they go, but by the time they are loaded by hook_mail_alter(), any token has already been replaced. Is it possible to ...
user avatar
0 votes
0 answers
9 views

Default values for route parameters in REST resources

The title says it all: is it possible to set a deafult value for a parameter configured in the uri_paths of a RestResource? I had a look at the code of RestResource and I have a feeling that it is not ...
user avatar
0 votes
2 answers
39 views

Composer\Downloader\TransportException: The "drupal.org/packages.json" file could not be downloaded (HTTP/1.1 404 Not Found)

In Drupal 8.9.x, After composer cache-clear. I am getting this error [Composer\Downloader\TransportException] The "drupal.org/packages.json" file could not be downloaded (HTTP/1.1 404 Not ...
user avatar
0 votes
0 answers
30 views

hook_form_alter makes js on every other form not work

I use hook_form_alter() to alter a field. function mymodule_form_alter(&$form, &$form_state) { if ($form['#id'] == 'my_form') { $form['my_field']['#value'] = 'New value'; } } It ...
user avatar
  • 133
2 votes
1 answer
86 views

Return AccessDenied for custom page

I've setup a custom page in my system which is expecting 2 parameters that will be used to generate part of the content on that page, I'm able to retrieve the information from my page, but I'm ...
user avatar
0 votes
0 answers
19 views

How do I selective limit Product Attribute values when using them as an Exposed Filter in a Product list View?

I'm using the Commerce module 2.x. What I have: Product Category taxonomy List of product categories Product Color product attribute List of product colors It has a Product Category entity reference ...
user avatar
  • 11
1 vote
0 answers
29 views

How to wrap select list in custom html?

I have a select list created by views exposed filters. When I debug the templates used. I have the exposed filter template, then the select list is in a seperate template. I tried just putting my html ...
user avatar
  • 133
0 votes
0 answers
45 views

State API doesn't work on new paragraph fields

I have programmatically added #states into fields in a paragraph works fine for existing fields in a form. But on clicking add more button on paragraph to add more fields the hidden fields show up. I ...
user avatar
  • 15
0 votes
1 answer
20 views

How to hide / modifiy ['operations']['#links'] edit / delete under structure -> menus in D8

I am trying to hide the edit and eelete links in the operations menu under structure -> menu for specific roles. I was just trying to hide the operations dialog at all by this code but it returns ...
user avatar
  • 281
0 votes
0 answers
65 views

Upgrading to 8.8.0 Receive PluginNotFoundException: The "group" entity type does not exist

I'm updating from 8.7.4 to 8.8.0. After updating core/modules and running "/update.php", I receive the follow error: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "...
user avatar
1 vote
0 answers
27 views

graphql mutations, how to create link field?

I am following this guide. https://drupal-graphql.gitbook.io/graphql/mutations/mutations I have created a module and with a plain text field I can run mutation { createArticle(data: { title: "...
user avatar
  • 133
0 votes
0 answers
40 views

How do I programatically change a webform's element type?

I am using a webform element 'select_other' in the webform. We got a requirement that the Other field should only appear if certain conditions are satisfied. I already have a Webform Handler In place, ...
user avatar
0 votes
1 answer
36 views

Update menu links based on the site URL

I have URLs defined in links.menu.yml file as "route_parameters: {webform: 'abc'}", but I need to update webform value based on the page URL. If URL has "/type1/" in it, keep ...
user avatar
  • 113
0 votes
2 answers
39 views

Checkout Flow Submit Pane Form Checkbox to Boolean Field

I create a Checkbox in the Checkout Flow, CheckoutPane. How i can send the Value of the Checkbox to a Entity in the User-Profile or the Order. Description: I need a Checkbox in the CheckoutPane, when ...
user avatar
0 votes
0 answers
25 views

Several "from" addresses

I would like to be able to send multiple emails that my site sends from different accounts. Is this possible in Drupal? I use Drupal 8 and SwiftMailer.
user avatar
  • 43
0 votes
0 answers
21 views

Custom field type properties populated by fetched data

I have a custom field type, org_person, with an autocomplete set up on it to search our endpoint of "people". It saves something like John Smith (12345) to the value property ($properties['...
user avatar
1 vote
0 answers
30 views

Drupal 8 Theme suggestions for form children elements [duplicate]

What is the best way to define template name suggestions for children elements of form in drupal 8? In myTheme.theme I can define hook like this: function myTheme_theme_suggestions_alter(array &$...
user avatar

1
2 3 4 5
317