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
1answer
54 views

How to keep similar custom services from conflicting?

I have two modules, each of which is defining a normalizer service module_one.services.yml services: module_one.normalizer.node_entity: class: Drupal\module_one\Normalizer\...
-1
votes
1answer
43 views

admin/reports/updates page not found

On a Drupal 8 project, the admin/reports/updates is not accessible. It just returns a 404 error without any issue.
0
votes
0answers
25 views

Testing an internal Drupal API that requires POST

I want to add a test around an internal API in Drupal 8 that only accepts a POST payload and fires off some services. I am getting the following: "curl error 3" From Guzzle when trying: $...
0
votes
2answers
55 views

What's the best way to migrate from manual upgrades to composer updates?

I have an 8.9.19 installation that I would like to move over to use composer. What's the best way to migrate the installation to use composer upgrades? Manual installations are becoming a real pain.
0
votes
1answer
32 views

Auto create a feed when a node is added

I am looking for a way to automatically add a feed (of a specific feed type), whenever a node is added (for a specific content type) using the node fields to auto-create the feed. I have searched this ...
1
vote
0answers
41 views

How do I override /libraries/ckeditor-wordcount-plugin/lang/some.js?

I'm using ckwordcount module which basically adds nice max length and counter features to text Fields, and relies on WordCount Plugin for CKEditor Editor. Most of the translations in the plugin lang ...
1
vote
0answers
29 views

Register form block into modal

I want to display the register form in a modal. For that, I created a custom plugin block which returns the rendering of the form register. /** * {@inheritdoc} */ public function build() { $...
0
votes
1answer
44 views

How do I get the entity ID from a view row and pass it along to the item list template?

I have a view which returns rows of entities. Each entity has several multi-value fields. The structure is kinda like this: Field 1: Item A Item B Item C ... Item H Field 2: Item A Item B Item C ...
2
votes
0answers
44 views

Is there a way to restrict time zone options in the DateTimeRange field widget?

Is there a way to limit the options of the timezone field in the datetime or datetime range widget in Drupal 8? It currently shows tons of timezones, but we really only need about 10 options. I ...
0
votes
0answers
5 views

Populate a node form field's select options from a view output (values only)

I'm looking to populate a node form field's select options (not sure the type of field to use) with values from a view output? I know Entity Reference field has that option... but it forces you to ...
0
votes
2answers
50 views

Change langcode

How can I change the entire site <html lang="en"> to <html lang="en-US">? I couldn't find anything on the Internet.
0
votes
0answers
22 views

Permission 'apigee.apiproducts.list' denied on resource 'organizations/betsol-innovation-lab' (or it may not exist)

I am using Drupal 8 based Apigee Developer Portal Kickstart. I have an Apigee X free account, created API proxies and published also. I have connected my Apigee X account with developer portal through ...
2
votes
1answer
72 views

Varnish in multilingual site

I have a multilingual site where I use in most of my custom modules (.module files) and in the mycustomtheme.theme file these lines of code : \Drupal::languageManager()->getCurrentLanguage()->...
1
vote
1answer
58 views

Comments on user profile not working

I want to add comments to user profiles. I added the comments in user profile under Configuration > People > Account settings, but when I add the field, the option to select the comment type is ...
1
vote
1answer
47 views

Hook webform options WEBFORM OPTIONS ID alter() [closed]

[{"value_1":"Dragon fly"},{"value_1":"Agapostemon angelicus"},{"value_1":"Albuna oberthuri"},{"value_1":"Callohesma ...
0
votes
0answers
32 views

Placeholder is replaced with label text

I am new in Drupal Community, I am trying to create a form using webform module in drupal 8, i have setup the placeholder for textfield but it won't show on the form, its taking label as placeholder. ...
0
votes
0answers
41 views

Render fields and results of a custom form in two separated regions

I have a custom form (created programmatically). I want to keep the AJAX submission mode. I would like to render the fields of the form in a region SIDEBAR and then the results in the region CONTENT. ...
-1
votes
1answer
61 views

How can I programmatically replace a string on the front page?

I create a custom module which replaces some string on the front page. For nodes, it work correctly, but it doesn't work on the front page. I wrote this code. function my_module_preprocess_page(&$...
0
votes
0answers
44 views

Webform created date

Is it possible to see the date a webform was created? We use webforms extensively and sometimes they have very similar names, we want to be able to see when a webform was created to be able to ...
0
votes
2answers
55 views

How can i render a file using a formatter programmatically in a controller?

I'm trying to create a controller to render a swagger documentation using the module swagger_ui_formatter that provide a formatter to the file field that render swagger files (yml, yaml, json) using ...
0
votes
1answer
41 views

Multiple sites/default folders

I have a Drupal 8 website on Docker containers. Drupal sites folders contains, besides the default folder, two folders, the settings.php file, and configuration. The goal is to have different ...
0
votes
0answers
18 views

How set violation to postal_code field on Address Fields

Address field is collection of other fields that one of them is postal_code. I wrote a custom validation constraint. It is applied and working. but the error message is showing for all fields of ...
2
votes
2answers
40 views

Joining two text fields in a Computed Text field

I have two fields whose type is List (text). In the allowed values list, i want to join them. I used the following code. $value = $entity->field_a->value . $entity->field_b->value; $value =...
0
votes
1answer
55 views

Why isn't the Endroid\QrCode\QrCode found?

I created a custom module and installed the endroid/qrcode library in my module using Composer. When I try to use that library, I get the following error. Error: Class 'Endroid\QrCode\QrCode' not ...
0
votes
1answer
25 views

Access product field from variation field

There are a bunch of product images that are named same as SKU, so I'm just using field--commerce-product-variation--sku.html.twig to show them. All is fine. I'd like to use the parent product image ...
0
votes
0answers
60 views

Programatically reorder referenced entities by field

I have a content type Speaker that uses an Event content type as reference. The Event has a start date and time field. There can be any number of events that a speaker speaks at, when visiting the ...
-1
votes
2answers
40 views

How do I add ajax callback to a form element which is created in a foreach loop

Please see the following code: foreach ($formaddresses as $key => $val) { // Add edit buttons to custom client-side created addresses. if (!isset($val['accountnumber'])) { $form['orderinfo']...
0
votes
0answers
70 views

modify custom block using hook_entity_type_view_alter()

In Drupal 9, I am trying to use hook_ENTITY_TYPE_view_alter() to modify the body field of a custom block. However, I don't know how to access the data in the $build array to change it. This is a ...
1
vote
0answers
14 views

How do I get all the entities for which at least one of the filter conditions is true?

I set Filter type to expose to Grouped filters. Then, I set the filter values. The view returns entities for which all the conditions are true. How can I get all the entities for which at least one ...
0
votes
0answers
19 views

Filter to embed content of another node

I'm migrating site from ancient Drupal 4.7 to Drupal 9. Does exist a filter which substitutes an in-text macro e.g. {{nid:123}} with content of node 123 ? Seems latest implementation is https://git....
1
vote
1answer
13 views

Can I pass a view's exposed filter values to the next page?

I have a D8 site view with exposed filters. I want the selected filters from that view to carry over to the next page's URL. For example: The page lists software titles. If someone filters on OS, and ...
0
votes
0answers
15 views

Changing base theme directory

I have inherited an 8.x site using ZURB Foundation as a base theme. However: Foundation somehow got installed twice, once in docroot/themes/zurb_foundation (8.x-6.0-alpha4) and once in docroot/themes/...
1
vote
1answer
20 views

How accurate is the field list for estimating where fields are used?

I am trying to locate all places where a particular field is used. I am trying to see especially which all Views have required the field. I was planning to do a manual search using editor Find and ...
0
votes
0answers
21 views

Delaying a Rules action until previous actions are complete

I'm making an HTTP request in an action which obviously takes some time. I want to use the response of that request in another action, but every time I get an error since the request hasn't completed ...
-2
votes
1answer
171 views

I cannot call a function in another JavaScript file [closed]

I have two JavaScript files on my custom theme. One file has functions that need to be used on the other file. What I have below doesn't work. This is the error I get. Uncaught ReferenceError: test ...
1
vote
1answer
66 views

Update FieldStorageConfig for a field in an update hook properly?

I need to update the allowed values option on an list_integer field. For reasons at the moment, I can't just update and export the configuration and import it on production until we implement ...
1
vote
2answers
103 views

Cloudflare cache everything

we have a Drupal 8 with Cloudflare cache rule. By default we have always GBP currency, then we developed a module that allow users change their currency with a footer dropdown and saves it on the user ...
0
votes
1answer
53 views

Custom block plugin does not show in Layout Builder options

Newish to Layout Builder - we made a custom block plugin that renders a custom form. When I go to a page with Layout Builder and try to add that block... it is not in the list of blocks. /** * ...
0
votes
0answers
39 views

admin/modules takes 40 seconds to load after uninstalling custom module

During the development, I made a couple typos in the block which resulted in Drupal seeing the module as being deleted without having been uninstalled first. When I realized what I had done, I put ...
0
votes
1answer
38 views

Actions form array overriding to set HTML id attribute

I extend the EntityForm class and I try to override a submission button, to set its HTML ID attribute (try #1). Since it doesn't work, I tried to wrap the button in a wrapper <div>. I tried to ...
0
votes
2answers
45 views

Hash in menu item url are removed when displaying the menu on a page

If a menu item has a submenu and I specify the hash symbol (#) in the Link field of such parent menu item in the admin panel, I receive empty url at the frontend and therefore if click by such link, I ...
0
votes
0answers
25 views

Migration lookup and no stubbing

I have a problem with languages and no stubbing regarding migration_lookup plugin in Drupal 8. I have a different json data, each of them is different languages for example json with de: data:{ id: ...
1
vote
1answer
66 views

How can I bulk delete users? [duplicate]

My site got hacked and I had an online service clean it out. However, it now has over 150,000 user accounts, the bulk of which have no role assignment. How do I delete these accounts and their content?...
1
vote
1answer
122 views

Is it a valid approach to have a different CSP based on login state and browser?

I'm currently working on improving the security of a Drupal 8 site by implementing a Content Security Policy. As this is still new to me, I would like to get some input on my strategy. Relevant base ...
0
votes
0answers
43 views

Entity field condition with "Not Contain" target_id for field multiple values [duplicate]

Entity E have a field reference to Taxonomy T with multi value. E.field_term.value = [ ['target_id' => 1], ['target_id' => 4], ['target_id' => 7], ['target_id' => 9], ]; How to ...
0
votes
1answer
93 views

Render custom field from user registration form

I'm trying to render a custom field that shows up on the user registration form on a separate new form that creates users of a particular role with specific permissions. I have everything working ...
-3
votes
2answers
89 views

can I set multiple JavaScript files on a custom module library?

I created a new module and I need to add multiple JavaScript files to my pageI. Should I create a new library for each file, or is it possible to add multiple JavaScript files on the same library as ...
0
votes
0answers
39 views

Custom entity with dynamic paths

I am creating a new entity and would like it to be in the users profile. The path should be "/user/{user-id}/documents/X": /* * links = { * "canonical" = "/user/{user}/...
0
votes
0answers
44 views

Add access to a single node programatically via ACL module

I spent a day trying to figure out why my code doesn't work. I'm trying to add access to a user on a single node programmatically. It saves record in DB and when I visit Access control page for a ...
1
vote
1answer
37 views

How to differentiate two different node creation/edit pages

I have 2 views, each one with a type of node (Products and Users). I want to add a unique class in each node create/edit pages, but i can't find any difference between the two, the only way i found is ...