CSS styles aren't applied to the pages

12 hours 26 minutes ago

On my site, CSS styles aren't applied to pages. The site is working and I have no clue why this is happening.

I have installed Nginx and php70-fpm on macOS El Capitan. I am using the configuration from drupal.org with a slight change.

server { server_name drupal.mac; root /Users/fabriziomazzoni1/nginx/drupal/; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } # Very rarely should these ever be accessed outside of your lan location ~* \.(txt|log)$ { allow 192.168.0.0/16; deny all; } location ~ \..*/.*\.php$ { return 403; } location ~ ^/sites/.*/private/ { return 403; } # Allow "Well-Known URIs" as per RFC 5785 location ~* ^/.well-known/ { allow all; } # Block access to "hidden" files and directories whose names begin with a # period. This includes directories used by version control systems such # as Subversion or Git to store control files. location ~ (^|/)\. { return 403; } location / { # try_files $uri @rewrite; # For Drupal <= 6 try_files $uri /index.php?$query_string; # For Drupal >= 7 } location @rewrite { rewrite ^/(.*)$ /index.php?q=$1; } # Don't allow direct access to PHP files in the vendor directory. location ~ /vendor/.*\.php$ { deny all; return 404; } # controllers other than update.php in a future release. location ~ '\.php$|^/update.php' { root /Users/fabriziomazzoni1/nginx/drupal/; fastcgi_split_path_info ^(.+?\.php)(|/.*)$; #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini include fastcgi.conf; $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_intercept_errors on; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; } # Fighting with Styles? This little gem is amazing. # location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6 location ~ ^/sites/.*/files/styles/ { # For Drupal >= 7 try_files $uri @rewrite; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } }

The server name is also set in the /etc/hosts file in my local computer.

Fabrizio Mazzoni

Update payment method pane with ajax

13 hours 27 minutes ago

I have the coupon pane, the order review and the payment info panes all on the same checkout page. When I add a coupon, an ajax callback is fired and the order summary is automatically updated to reflect the coupon, but the payment info pane is not updated.

I have a rule for two payment methods. One for non-zero order totals, and one for zero total orders. If I add a coupon that brings the total to zero, and then refresh the whole page, the rule action does apply and enab;es my 'free' payment method. However, it only works with a full refresh.

Is there a way to get the payment info pane to refresh during the coupon add ajax callback?

Otherwise, my customers see a zero total and they still see the payment info that requires them to put in a credit card to finish the order.

meecect

Add the same field multiple times to a display suite node display

14 hours 25 minutes ago

So I'm using display suite with a 2-column layout, and my node has an entity reference field (field_journal). I'm already displaying field_journal as a rendered entity in the LH column, but I'd also like to display a different grouping of fields from the linked entity in the RH column.

I was thinking the best way to do that would be to add field_journal again to the RH column, but I can't figure out how to duplicate fields in display suite.

Is there some way to add the same field to a node display in 2 different places in the layout? Or can anyone help me with a workaround?

Tim Stallmann

How to automatically create account after an order have been placed

14 hours 27 minutes ago

I am looking to set up an e-commerce site on Drupal 10 (Commerce 2).

Here is the goal:

A user should not be able to create an account without having placed an order. Therefore, on the account settings page (admin/config/people/accounts), under "Who can register accounts?" I select: administrators only.

During the checkout process, the user has two options:

Either they have previously ordered on the site and thus have an account and can log into their account before finalizing their order. If they do not do so and their email is recognized once the order is complete, the order is automatically attached to their account.

Or they do not have an account, in which case they are invited to proceed as a guest. In this case, the account is automatically created once the order is completed, and the user receives an email to log into the newly created account, change their password, and their username (by default it is the email used for the order).

Therefore, in the checkout process, I select:

Assign an anonymous order to a pre-existing user (If the email associated with the order matches an existing user account, the order will be assigned to that account.)

Create a new account for an anonymous order (Creates a new user account on checkout completion if the customer specified a non-existent e-mail address.)

Notify customer of their new account (Sends an email alerting the customer of their new account, with a password reset link to access their account.)

However, when an order is "placed," no user account is created.

Please can you explain where I am making a mistake.

Thank you in advance for your responses.

Alexdezark

Errors when Taxonomy is chosen in node's Term Reference field

15 hours 23 minutes ago

I have created a vocabulary called "Recipes" with several terms underneath (Appetizers, Dinner, etc). I also have a content type called "Recipe" with a Term Reference field for the Recipes vocabulary.

When a term (let's say Appetizers) does not yet have a node referencing it via that Term Reference field, the term's page shows up fine (albeit without any node content). However, when I choose one of those terms on a Recipe node via that Term Reference field, the term's page shows three error messages and various elements of the page (such as the footer and the nav bar) are not displayed. The errors are:

Notice: Undefined property: stdClass::$type in _node_extract_type() (line 379 of /home/mysite/public_html/modules/node/node.module).

Notice: Undefined property: stdClass::$nid in node_build_content() (line 1417 of /home/mysite/public_html/modules/node/node.module).

EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7721 of /home/mysite/public_html/includes/common.inc).

I upgraded from 7.24 to 7.26, but that did not fix the issue. Google has not been particularly helpful. Does anyone here have any feedback on what might cause this issue? FYI, I also added a Term Reference field for the built-in "Tags" vocabulary, and the same issues occurred.

hockey2112

How can I prevent cache on any page where a paragraph appears?

16 hours 21 minutes ago

I am using the paragraphs module with a custom theme I created. I want to figure out how to clear the cache for any page that a specific paragraph appears on. The custom theme is composed of a bunch of templates (i.e. paragraph--paragraph-name.html.twig) and a *.theme file where I preprocess each of the paragraph types.

THEME_preprocess_paragraph__paragraph_name

I don't want to disable the entire site's cache. Can I clear the cache in this file? In this way somehow?

Ryan H

How does drupal send emails by default?

17 hours 23 minutes ago

I have a site working on drupal 6 , and i uses drupal's default email function drupal_mail() to send emails , but unfortunately its not sending email and gives me "email not send , please contact site administrator" error , is there any smtp settings i need to include ?

When i tried like follows :

$to = "test@example.com"; // to e-mail address $from = "test@example.com"; // from e-mail address $subject = "text to display in e-mail subject"; // subject of e-mail $body = "text to display in e-mail body"; //params is the array passed to hook_mail function $params = array( 'subject' => $subject, 'body' => $body, ); if(drupal_mail('test', 'information', $to, language_default(), $params, $from)){ echo "mail send successfully"; }

it gives me mail send successfully message but mail is not delivered .

KTM

How do I create translation without default language content?

18 hours 19 minutes ago

In Drupal 8, my default language is English, but I also have German. How can I create a content item that will only be available for German, and not in English? In other words, how do I created "translated only" content?

When I add new content, I can use the Language select box, but it still creates content available in the English language.

croceldon

Custom Drush command and Settings::get(), Config::get()

18 hours 21 minutes ago

how can I access site configuration when in Drush command?

Global variable $config === null and when I use Config::get('key'), I get

Error: Using $this when not in object context in Drupal\Core\Config\Config::get() (line 85 of /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Config/Config.php)`

What is the recommended approach? I can't find it anywhere... thank you!

Edit

I actually intended to access Settings, not Config - that's where the confusion came from. Settings::get() works just fine. To get data from config, just follow the accepted answer.

informatik-handwerk.de

Apache Solr Search proper syntax in url?

19 hours 20 minutes ago

Can anyone provide some info on how to properly execute a filtered apache sold search through the url? So far I've figured out that

?fq[]=bundle:type

will return a results filtered by that bundle type. I've also noticed that

?f[0]=machine_name:value

will return results if that particular facet has been configured. What I want to figure out, though, is how to use the url to send any filter request. For example, if I want to write a url that would return results based on a particular taxonomy term, how would I enter that? Furthermore, can any field be used to filter a search?

Jordan Bundy

Webform hook field text element

20 hours 27 minutes ago

I Use Drupal 8.8 with Webform 8.x, in a simple webform with a select list element and a text field element, I need to update a text field element with values resulting from database queries when the user chooses an option from the listbox.

I would like to accomplish this with a PHP code in a custom mymodule. How can I intercept the user's action when selecting a value from the select list?

Besides intercepting the event I also need to know the content of the choice that the user has made on the select list.

How can it be done? Can anyone give me an example?

Serghei Garau

Free/loose mode content translation with paragraphs

21 hours 20 minutes ago

The content_translation module available since Drupal 8 allows me to translate content pages (entities/nodes) in a very strict mode: Each paragraph on the source language page has a translated equivalent in the target language.

I'd like to have a more free form approach to the translation; a page in the translated language may have completely different content than the source language.

Example:

  • Source page contains Headline, Image, Text
  • Translated page contains only Headline and Image, but the Text paragraph is removed. Another Image is added.

Basically I want to be able to have content/paragraphs on page that are only available in a specific language.

How can I achieve this?

cweiske

Module installation order

21 hours 23 minutes ago

Within my custom module i've got an optional implementation to the dynamic entity reference module: https://www.drupal.org/project/dynamic_entity_reference

When the module exists, I add a DER field to one of my custom tables during the module installation.

The issue i am currently facing is that I can not manipulate the installation order of my module. Within the install hook of my module i am using module_set_weight("mymodule",1). However this is not effecting the installation order at all when I run drush config-import order or drush site-install --config-dir="/my/conf".

Within my core.extensions.yml the weight got applied after config export: drupal_content_sync: 1

Sebastian

Appointment scheduler with webform with setting to select/enter email

21 hours 48 minutes ago

Following the scenario for appointment tool

  1. In first step there is a calendar where user select the date.
  2. In second step user selects the time for the date selected.
  3. Remaining steps are contact form and confirmation.

Now the challenging part is - in the first step I need to called the API to get list of available dates and times. I'm planning to build custom form element for date and time selection separately, but the question is where to store email for settings, which I can retrieve for fetch date and time?

Also since single API call is providing both dates and time slots, I want to store it and share with both steps, So where to store data to share between steps?

Sharique

How override theme for a node add\edit form?

22 hours 20 minutes ago

I'm on D10.2.x. My site uses Gin as back-end theme but also as fallback front-end, being decoupled and having to "front-end page" actually shown via Drupal.

I'd want to override the default node add\edit form for some extra html markup. As I can't just override via a *.twig template in the theme folder, I'm trying with a module.

I've tried wit the code\example from e.g. How do I theme a custom form? or https://makedrupaleasy.com/articles/drupal-10-how-render-any-form-twig-template

My code is the following:

my_module.module:

/** * Implements hook_theme(). */ function my_module_theme($existing, $type, $theme, $path) { return [ 'my_custom_form_twig' => [ 'variables' => [], 'render element' => 'form', ], ]; } /** * Implements hook_form_alter(). */ function my_module_form_alter(&$form, FormStateInterface $form_state, $form_id) { //removed temporarily the check on $form_id $form['#theme'][] = 'my_custom_form_twig'; }

/templates/my-custom-form-twig.html.twig

{{ dd() }} <h1>MY CUSTOM TWIG</h1> <form{{ attributes }}> {{ children }} </form>

dump result

array:13 [▼ "form" => [] "theme_hook_original" => "my_custom_form_twig" "attributes" => Drupal\Core\Template\Attribute {#1517 ▶} "title_attributes" => Drupal\Core\Template\Attribute {#1738 ▶} "content_attributes" => Drupal\Core\Template\Attribute {#1515 ▶} "title_prefix" => [] "title_suffix" => [] "db_is_active" => true "is_admin" => true "logged_in" => true "user" => Drupal\Core\Session\AccountProxy {#1404 ▶} "directory" => "themes/contrib/gin" "theme_hook_suggestions" => [] ]

However this doesn't work, as I'm facing two issues:

  1. As a test, I've checked that the override works for most forms on the site, as they are replaced with my custom twig. However, the node edit\add forms still use the original one, so I suppose some extra logic is done by the Node module and I need to do something more to override it, but I don't know\can't find what.
  2. As shown by the dump of my twig (in the other places of site), the form array is actually empty. There is also no element or children object so I can't rely on them as fallback. Therefore my twig can't actually print the form.

Thank you for suggestion on either of the two problems.

Giuseppe

How to render entity reference data in field template?

22 hours 23 minutes ago

I have a field collection with adding multiple items. In each item there is an entity reference field with multi-selection of contents. I can render entity reference content by target_id using node_load in an entity_reference field template. But it is getting only first value of each item.

How can I render all contents of each item from field collection? Is there another way to fetch?

Reshma

How to get cloudflare streaming video URL?

22 hours 26 minutes ago

I have install and configured https://www.drupal.org/project/cloudflare_stream module in Drupal 10. I have used "Field type" as "Cloudflare Video" for upload file field.

I haven't received any response to save after complete the file upload.

Video file is locating my LOCAL path only, not cloudflare streaming video path.

I am expecting the data "Video ID" , "Video URL" and "Video streaming URL".

How to display the cloudflare streaming video ?

Ramalingam Perumal

Multiple relationships in Views Contextual Filters

23 hours 20 minutes ago

I use Views in every project, and its not that often that I run into a use case like this any more.

In the set up below, I have a Content type with two field collection fields (day guest and evening guest). I want to display the results of both field collection fields on the node, in the same view.

Both field collections share an "E-mail" field, and when a user enters their e-mail field, I want them to see their results, whether they have been added as a day guest, or an evening guest.

Here's the setup...

When I remove one of the two Contextual filters, the results show for the remaining field, and vice versa. But when both Contextual filters are added, I get no results.

Is there a way to do an AND or OR for Contextual filters?

Or in the Contextual filter options, a way to add multiple relationships like below?

While I know this is not possible in the default behaviour, it is a good example of what i'm trying to achieve, perhaps someone knows a decent workaround to the issue?

Collins

User must click Back button twice after adding item in cart

1 day ago

I have added Drupal Commerce in an existing D7 site and I use the existing product nodes, in which I have added the Add to cart form. Everything looks nice and works fine, except for one thing. When a user adds an item into the cart and then tries to go back one step by clicking the browser back button, he or she stays on the same page. So the user must click twice to go back one step. The history information about previuos pages, must still be there since one lands on the correct page, after clicking twice.

Maybe I should mention that I use Authcache with Ajax calls to fetch the Cart block on cached pages, but i think this behaviour started before I installed Authcache.

How can I fix this?

TBJ

searching and entity references

1 day 1 hour ago

I have two content types documents and authors. When creating a document a selection list of entity reference's to authors is used to select the author.

Searches for the author name find the correct author, but do not find the document that has an entity reference to the author. How do I get the search engine to to display both the author and the documents the author is referenced from.

EX Book "GOOD BOOK" is has an entity reference to Author "TOM".

When I do a search for TOM I get the "TOM"'s authors information but NOT an entry for "GOOD BOOK"

Joe
Checked
12 hours 23 minutes ago
most recent 30 from drupal.stackexchange.com
Subscribe to Drupal StackExchange feed