All Questions

Filter by
Sorted by
Tagged with
0
votes
1answer
422 views

mod_expires enabled and cache flush

I my apache I have mod_expires enabled. My htaccess contains: <IfModule mod_expires.c> # Enable expirations. ExpiresActive On # Cache all files for 2 weeks after access (A). ...
3
votes
1answer
152 views

Disabling Page Cache for Redirect Response

I've implemented a conditional redirect on my site via an event subscriber and returning a redirect response. It's working but, I believe due to the page_cache module is getting cached for anonymous ...
0
votes
3answers
490 views

sending mail without running cron

I have created a rule to trigger an email in user profile. But I could see the email after running cron only or else I could not see email in my inbox. Why is this? Can any one help in this please? I ...
0
votes
1answer
469 views

Remove field attributes from form or custom form using hook_form

How to remove the field attributes from form in hook_form_alter. like <input type="text" class="form-text required" maxlength="255" size="60" value="" name="title" id="edit-title"> EX: ...
-1
votes
3answers
46 views

How do I programmatically create a webform from a newly created node?

This is the code I am using. function walk_handler_entity_presave(EntityInterface $entity) { if (method_exists($entity, 'getType') && $entity->getType() === 'walk') { $elements = []; ...
0
votes
1answer
531 views

Request referer gets cached

I need to grab referer and save it for the first time (I save it to sessions) and when the user gets to a specific page forward it. My problem is that after opening page with the same referer few ...
0
votes
0answers
31 views

How to enable click-sorting for views table display based on Search API index?

I'm trying to create a view with table display based on Search API (database search) index, with column-sorting (column set as Sortable in the display settings). However, this option isn't available ...
0
votes
1answer
381 views

Some of my Panel content is missing for anonymous users. What went wrong?

I've set up a landing page panel with two items in it, a content page with a welcome message and a view showing certain content. It works great, but when I look at it as an anonymous user only the ...
5
votes
2answers
6k views

How do I programmatically create users?

I need to create users in code specifying password, email and other fields' values. How can I achieve this?
0
votes
1answer
334 views

How to disable a file upload button for anonymous users?

I've created a commerce add to cart form with a file upload field. The user can use this to upload a logo but I don't want anonymous users to be able to do this. I can see that the file module uses ...
-3
votes
0answers
16 views

How to get value of checked tableselect row [on hold]

Please help with tableselect element i want to get data from one of the checked rows. Here source: $options = array(); $nodes = db_query("SELECT order_id, order_number, created, status FROM {...
0
votes
2answers
337 views

How to display the pager on top and bottom of a custom search results page?

I have used the core Search Page functionality in Drupal 8 to built a search engine on my site. The pager is displayed at the bottom by default. How can i display the pager on the top also? Note: I ...
2
votes
1answer
17 views

drush migrate-upgrade “[debug] key_value table not found. Database may be empty.”

I am trying to migrate a D7 site to D8 following the steps found here . Once I can manage it and make sure I have all the PHP components, Drupal modules and etc. I have 4 sites to update, and one ...
0
votes
1answer
50 views

Create new node and assign it to user after they have been registered

I have one user role on d8 and have few additional fields on user account so when people are registering they can leave additional data. What I would like to achieve is that when user registers - new ...
4
votes
2answers
1k views

How can I convert the code that used drupal_get_http_header() to check if Drupal returned a 403 or 404 error?

I have a module that in hook_preprocess() checks with drupal_get_http_header() whether Drupal is returning a 403 or 404 error, but in Drupal 8 that function is deprecated, since header handling is ...
2
votes
3answers
337 views

Avoid user to multiple purchase of same product

I would like avoid a user to buy the same product twice or more, I'm not speaking about the quantity limitation during the checkout (I've already set quantity to 1 for every purchase)...for example.....
2
votes
1answer
827 views

TypeError on “drush config-export”

I've been receiving the following error message when trying to do a drush config-export command. However, I am able to successfully do the configuration export from the Drupal admin page (admin/config/...
0
votes
1answer
520 views

How to get the drush command defined in migrate tools to work?

I have a D8 site since some months. Today I realised that I needed drush in order to migrate some contents (using the migrate tools module). Composer was not installed, so I installed it. Then I ...
0
votes
1answer
332 views

Drupal 8 group filter conditions using views query filter

I'm facing an issue while applying filter in drupal 8 views. I have created a view of records where i showed content using filter conditions. Basically, I want to add a filter using AND/OR conditions ...
1
vote
1answer
465 views

How do I install a 3rd party PHP library in sites/all/libraries - can I just plonk it in there?

For example, according to the Drupal module s3fs, I can -- to quote their README.txt :- 2b) If you don't have drush, go to to http://aws.amazon.com/sdk-for-php and click the orange "AWS SDK for ...
0
votes
3answers
394 views

Contextual links for node blocks

I have the Nodeblock and the Contextual links modules installed. They work fine, but I want to add the "Edit node" link in the contextual links for node blocks. For views, there is a "Edit view" link, ...
0
votes
0answers
25 views

Cannot update modules, get a 403 error

An AJAX HTTP error occurred. HTTP Result Code: 403 Debugging information follows. Path: /core/authorize.php/core/authorize.php?batch=1&id=31&op=do_nojs&op=do StatusText: Forbidden ...
1
vote
1answer
402 views

Create a view block on a node reference field (using Node Reference)

Creating a related content block on a node reference field. I have two content types: Article and Author. The content type Article has the field Label: Por 'field_autor' which is a node reference to ...
0
votes
1answer
329 views

How can I refresh the adjustment tax after changing the line-item price?

I create orders programmatically, and I have a tax problem: the order, after changing the line item price, always has the tax cost with the old product price. How can I refresh the adjustment tax ...
0
votes
1answer
382 views

How can I alter (theme) the default content feed?

How can I alter (theme) the default content feed on the front page (the list of node teasers) so that my 'thumbnail' image style is used instead of my 'medium' style for the images contained in the ...
7
votes
1answer
1k views

How do I enable and use a view mode for a product type?

In default commerce2 (drupal 8) I want to add second product-type view mode, to show in views - like teaser version, including add-to-cart btn with variations. I have additional field in Product type ...
0
votes
0answers
19 views

Migrate one to many relationship

My D8 site has two entities: resource author The resource entity has a field_authors entity reference field with unlimited cardinality. My source data is coming from 3 tables resource author ...
1
vote
1answer
706 views

Migrate media with alternative text

I'm trying to import image with new media module on core 8.5. I've a json source and on my .yml I've: field_media_image: target_id: plugin: migration migration: immagini ...
0
votes
0answers
29 views

Drag and drop between categories functionality for users [on hold]

I have a content type where user selects a certain status and data is sorted for each status through views. I want to build a drop and drop functionality where users could move the box of each content ...
0
votes
3answers
1k views

User list view showing total nodes created for each user

I have a view which displays a list of particular users. For each user displayed I would like to also display the total number of nodes that user has created. I was wondering if there was an easy and/...
0
votes
1answer
420 views

Accordion display for views inside panel

I have a panel page which contains 2 views. I only want 1 view to display as an accordion. My problems are - If I set the style setting of the view to accordion - nothing happens. If I set the style ...
3
votes
2answers
559 views

How have multiple instances of a Custom Block?

So I have a custom block that has been created within the module. I have used the drupal API to generate the brand new fields - which works perfectly. However, I am having an issue regarding multiple ...
0
votes
3answers
355 views

Problem creating redirect from page with %20 [on hold]

I've been researching the issue for hours and can't seem to find a working solution to this problem. I've created a redirect from /sites/default/files/OLB%20Registration%20Guide.pdf to /sites/default/...
2
votes
1answer
334 views

Is it possible to create a hierarchical exposed filter in views using the Data module?

I'm using Data module to adopt tables from the same DB as 'native' Drupal tables and Views module to present the data. I added two dropdown exposed filters with Selective filter module. It takes all ...
1
vote
2answers
75 views

What is the correct way to use a Symfony bundle?

I want to use https://github.com/KnpLabs/KnpSnappyBundle in a Drupal 8 project. How do I correctly use it?
3
votes
2answers
539 views

Overriding permissions selectively via settings.php/settings.local.php

The use case is a development module that you would only have installed on a local environment. My thought was to use $config in settings.php to do this: $config['user.role.anonymous']['permissions']...
0
votes
1answer
10 views

Fill the “Unpublish on” date field of the Scheduler module depending on list field

I have a content type, where I want to give the user only three possibilities to unpublish content: in 1, 3 or 6 months. For the selection of the three options I use a list field. How can I transfer ...
-2
votes
0answers
30 views

How does mapping (OL/Leaflet) actually work nowadays? [on hold]

After struggling for 9 months with OL2 on D7 then removing all 6 months work to try both OL3 and now leaflet (some 6 hours today and 5 hours last night) I'm coming to the conclusion that nothing on D7 ...
1
vote
1answer
393 views

How to change the SID of webforms to increment from a new starting number

We launched a new website that uses webforms but need to make sure our webforms are using an SID for results larger than the last number used on the old site. Please note that I am not referring to ...
1
vote
1answer
440 views

Update commerce cart block when product added through ajax

Hii How can I update commerce_cart_block when my product is added through ajax. Any suggestion will be helpfull.
0
votes
1answer
343 views

Change “Custom Text” field value

In Drupal 8, I created a view containing a Custom Text field. I want to alter/change its content for each row I get after running some code. I tried implementing hook_views_pre_render() and ...
1
vote
1answer
390 views

Pass data to hook_entity_insert

How can I pass data to hook_entity_insert() given that the arguments it takes are fixed? I'm writing to the database during entity save, and need to be able to pass some data in this hook.
0
votes
0answers
29 views

Displaying translated nodes in views [duplicate]

I am facing a challenge in displaying views for translated contents. Consider a general scenario: Multilingual site with English(site default), German languages. A content type Article has 100 ...
0
votes
0answers
17 views

How to get a second private files directory?

is it possible to create a second private files directory in addition to the existing private files directory? For a better file structure diversity I would like to set a different second location. ...
1
vote
1answer
674 views

How to sort the query results?

In my task I need to display the results based on "the newest first". I perform a query: $query = \Drupal::database()->select('node_field_data', 'node'); $query->innerJoin('...
0
votes
1answer
340 views

Checkboxes in a simple form are not displayed

I have a simple form in a custom module that works well and is displaying my select as it should. $form = \Drupal::formBuilder()->getForm('Drupal\efq\Form\FilterForm'); $form["container"] = array(...
0
votes
1answer
58 views

How do I use hook_preprocess_page_title()?

I've just discovered that Drupal 8 Bootstrap theme doesn't implement all existent hooks. So, for example, hook_theme_suggestions_page_alter() works, but hook_theme_suggestions_node_alter() doesn't ...
1
vote
1answer
338 views

How to set node creation limit by user type in Drupal

I'm trying to set the limit on authenticated user for creating particular type of content(adding user limit on content type). Node limit module has same functionality in Drupal 7 but i'm looking for ...
0
votes
1answer
527 views

Twig Tokens in Views not Rendering Inside an HTML Element

I'm using views to create a custom block of shortcut icons and need the images to link to the corresponding content. Using Rewrite Results I can overwrite the output of the view and have an anchor tag ...
2
votes
1answer
35 views

Different CSS file when in development mode

Using Gulp I create two css files. One style.css and one style.min.css. Is it possible to load the style.css when developing (locally) and the style.min.css when in production (remote)?

15 30 50 per page