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

Using Content Synchronization to transfer nodes across environments with different users

I am attempting to use the Content Synchronization module to transfer nodes from environment to environment but ran into an issue with the Author. On my local environment, I created some nodes with a ...
0
votes
0answers
11 views

Render element after form is submitted

I would like to show a "Thank you"-overlay after my contact form is submitted. I already tried this, but this seems to fire one step too early: function my_theme_form_submit(&$form, &...
0
votes
1answer
11 views

How do I verify emails on a contact form?

I want to implement a functionality where anonymous users can contact node authors. I have created a contact form with email field for each node. I would like to send an email verification link to the ...
0
votes
1answer
19 views

Views: Assign a row class like “row-1” for row 1, “row-2” for row 2 [duplicate]

I have a view that uses the Table format. I want to add row classes like this: Row 1: .row1 Row 2: .row2 Row 3: .row3 In the Views UI, if I click Settings under Format: Table, then I can specify the ...
0
votes
0answers
7 views

How can I alter a Views query adding an OR clause for a relational field?

I have an "Event" node type with a number of fields: title, date, location, description, etc. Because a number of events are similar, we added a "Parent event" entity reference ...
0
votes
1answer
20 views

How can I use #tags in pager_default_initialize()?

I want different label for first/last/next/previous button in the custom navigation using pager_default_initialize(). How I can set an array that can change the button label. $total_count =9999; $...
-1
votes
0answers
17 views

How can I trigger a file upload?

I have a file field on a page. On that page, I have images using image tags. When I click on the image, I want to upload it to that file field. Just like we select an image from our computer and it is ...
0
votes
0answers
10 views

Trigger Crop API programatically after node is created

Hi I am using Image Widget Crop so that users can crop images according to predefined image styles. All would have worked fine without any issues had I been using Drupal in the conventional '...
0
votes
1answer
34 views

How do I prevent node enumeration?

I am currently developing a Drupal 8 site that will consist of one only central content type with a minimal menu structure. The user is supposed to navigate the site only by using a search/filter form ...
1
vote
1answer
9 views

How to create Media video youtube entity programmatically?

I need to create many Youtube video Media entities from URLs list. Can I have some example code?
-1
votes
0answers
11 views

Query to output title, alias and menu

I need a query for Drupal 8 that will show the node title, alias and parent item in menu (if none then blank or "none" for parent item). I'm brand new to Drupal and trying to find my way ...
0
votes
0answers
38 views

Dynamic block cache doesn't render

I have a menu that renders different items based on the entity association of the node being rendered. I've been trying many difference combinations of cache configurations for my custom block: ...
0
votes
0answers
29 views

How to display the rendered entity of a store in a code?

I created a custom module for Drupal 8 and Drupal Commerce. It is used to display a link "Accept the conditions of sale" in the purchase funnel during an order. This link displays a modal ...
2
votes
2answers
29 views

What is the replacement for menu_link_load()?

Drupal 7 has menu_link_load() to load a single menu item. What is the Drupal 8 equivalent?
-2
votes
0answers
18 views

Generate excel file with macrosCode through PhpSpreadsheet library [closed]

I am trying to create a .xlsm excel file while reading the macrosCode from the vbaProject.bin file. I implemented the following snippet: $filename = 'private://zips/xl/vbaProject.bin'; $handle = ...
-1
votes
0answers
18 views

Upgrading from 8.8.5 to 8.9.5: Getting 'Requirement Problem' error

I am trying to upgrade from d8.8.5 to d8.9.5 and I'm getting a requirements problem immediately after running update.php See screenshots It seems there's some table missing from database schema ...
0
votes
0answers
31 views

How can I get the data-action attribute?

I have a form that has a data-action attribute and an action. I want to get the data-action attribute to set a condition on it. I know that to get the action I must type $form['#action']. Any idea how ...
-1
votes
1answer
48 views

How to automatically flag entities once (without PHP error)?

I created a custom module to automatically flag new entities and update entities. It works :-) Here is the problem : If I update a neud it is flagged. Perfect that's what I want to do, but if I update ...
0
votes
1answer
40 views

Custom block build function to display wysiwyg body text

I am learning to build custom blocks through a module. I am trying to get the build() function to work. I have the code and it works. However, if I edit the configuration of the block as a user it ...
0
votes
0answers
16 views

How do I generate a search snippet similar to core search for a custom search API page?

I installed solr and search_api and search_api_pages. It's all working as expected but, for now, my new search page need a lot of configuration to display correctly. Unlike drupal core search, which ...
0
votes
1answer
19 views

Form API placeholder attribute rendered as “- Select -”

In a custom Drupal 8 module, I have a couple of Form API fields of '#type' => 'select': <? $form['form-right']['field_role'] = [ '#type' => 'select', '#title' => $this->...
-1
votes
0answers
21 views

Is it possible to select items in page and order by drag and drop them in another page in a multi pages form?

As in https://www.drupal.org/project/webform/issues/3037186 i'm asking the same request here as suggested in the issue On Drupal8 and Webform, is there a way to have something like that : user ...
0
votes
0answers
17 views

Exclude nodes referenced from another content type's node

I have two content type: Content type A Content type B In content type B I have one reference field which referencing Content type A. Now I want to build a list of Content type A, which is not ...
-3
votes
1answer
32 views

predefined blocks of content for the Layout builder module

Does the Layout builder module have a related module that bring predefined components blocks (e.g carousel, tabs, etc..) like in the Bootstrap paragraphs module or Gutenger blocks (cloud)?
-1
votes
1answer
30 views

Custom block theme not appearing in QuickTabs content

I'm attempting to create a dashboard page that contains 4 tabs that are each a block that will contain a content based on the current user. I went ahead and created the 4 blocks (bl1, bl2, bl3, and ...
1
vote
1answer
24 views

Content moderation - workflows / weird behavior

I have set a content moderation workflows for my content type : Draft and Published states. Pretty basic, i create a content in Draft which is not published, i can change the moderation_state to ...
-1
votes
1answer
70 views

How do I flag new user accounts or updated accounts?

I created a custom module to automatically flag new user accounts and updated accounts. When I create a new user or update an existing account, it is not automatically flagged and there is no error ...
0
votes
0answers
22 views

Execute command line script in module file

I am using Drupal 8.9.5 and I need to compile a SCSS file using Gulp command in our module file. If I execute the command from the command prompt, it works without any issues, but when I tried from ...
0
votes
0answers
21 views

I want to reset a managed_file field after AJAX form submission

I implemented a form with managed_file field. $form['field_name'] = array( '#type' => 'managed_file', '#upload_location' => 'public://node_file/', '#upload_validators' => array( '...
0
votes
0answers
13 views

Displaying sub content (entity references) of node based only with specific taxonomy

I have been working on a solution that would allow training courses to be created using Drupal 8 as the backbone. I have elected not to use the "Courses" module and am simply using custom ...
0
votes
0answers
38 views

Get a session value in a template file

I am trying to get value set in session in a template file, but I don't get the expected value. I tried two methods, but neither of them works for me. The code in the custom module controller is the ...
0
votes
0answers
16 views

Can I clone a fieldset?

In Drupal 7 there is an option to clone fieldsets in webforms, but I don't see this in Drupal 8, even if I can duplicate any other field in the webform. Am I missing something?
0
votes
0answers
23 views

Drush Launcher looking for Drush in public_html when using updb

I have a drupal 8 website up and running on a server. On this server I use the Drush Launcher to work with Drush on my site. For some reason the Drush command drush updb doesn't work I get the ...
0
votes
2answers
54 views

How do you target a specific type of content?

I have the content type (node), article, page, recipe. The code below can be used to flag any type of content. How do you target a specific type of content ? For example I only want to flag the ...
0
votes
0answers
14 views

How do I prevent anonymous users from modifying and deleting their submissions after a webform closes?

I'm using Drupal 8.9.6 and Webform 5.20 Background I have an event that lasts 7 days and I've created a registration webform (using Webform Nodes) for each day. Each webform gives anonymous users the ...
0
votes
1answer
24 views

How do I get the administrator to automatically flag?

I created a module for flagging entities automatically when created or updated. There are some errors in my code because only nodes work. If a user "user1" creates a node, the flag will be ...
2
votes
1answer
24 views

“Order items” view displaying removed items (variations)?

I'm dynamically removing items from cart with this function: static function _remove_product_variation_from_cart($variationId) { $orders = \Drupal::service('commerce_cart.cart_provider')->...
0
votes
1answer
32 views

Class not found in custom module

The mailchimp class is not found in my project. I understand I do not have to add the 'require_once' function in D8? I use phpStorm. The project recognize the class ... The info is found at: https://...
0
votes
1answer
19 views

Setting node ID sequence to a particular higher value for future created records

We have an organic groups based portal in D7 where many blood banks add records. We recently initiated Drupal 8 migration and are close to completion. However, we would want to add selective blood ...
0
votes
1answer
23 views

Migrating with CiviCRM

I have seen several articles and tutorials covering how to do a fresh install of CiviCRM along with Drupal 8. My question is how to properly set up a migration from a combo Drupal 7/CiviCRM site to a ...
0
votes
1answer
57 views

How do I flag the update store automatically?

I created a flag to flag the stores. I want when a user updates a store, the store is automatically flagged. The code below does not work and there is no error message. I don't want to use the Rules ...
0
votes
1answer
36 views

Count multivalue image field values in views-view-fields.html.twig

Making a presentation template for the gallery. The photo gallery has an image field with multiple values. I need to output the number of gallery photos (in the field_gallery_photo). How do I do this? ...
1
vote
1answer
41 views

How do I track a publicly downloaded file?

I am creating a custom module to track the file download time and user id with a file link or path. I have tried multiple modules but the download the file time tracking option is not available. How I ...
0
votes
1answer
43 views

How to properly program AJAX links?

I have a custom module that uses AJAX. Everything works fine the way it is. I'm just wondering if it's the proper way to do it in Drupal. I'm new to Drupal 8 and 9 programming This is a line from my ...
-1
votes
1answer
54 views

Cannot flag nodes and comments automatically

I created a code to automatically flag nodes and comments. When I put only the code to flag the nodes, it works. But when I add the code to flag the comments it doesn't work anymore. Which code should ...
0
votes
1answer
26 views

Why there is not loadData() method in FileSystem?

To use the private:// scheme of Drupal 8 I had to : Create a folder outside the docroot folder Implement a $settings['file_private_path'] = '../private-files'; to designate this folder Make sure ...
2
votes
2answers
42 views

Non-blocking HTTP request with Guzzle

Is there a Drupal 8 way to do non-blocking HTTP client request using Guzzle? I don't need to wait for the answer of The HTTP post, as that is slowing down the site. I already seen Non-blocking ...
-1
votes
0answers
19 views

Creating a content type/reference entity to store product feature comparison data

I want to be able to manage the data in the table above using Drupal 8 content types/reference entities. I am not sure how to explain this in words. Please have a look at the image attached. At first ...
0
votes
0answers
44 views

Set condition using rule module to pass one content type field's value in second content type

I have created two content type Album details and Photos of album. In Photos of album content type i added field (Entity reference type of first content type i.e Album details) and widget as select ...
0
votes
1answer
26 views

Allow authorization via cookies

We are migrating from Drupal 7 to Drupal 8 and are currently at the last hurdle - relying on Drupal's session to authenticate for custom scripts. Previously we used to rely on drupal_bootstrap but now ...

1
2 3 4 5
299