oksana-c
  • Member for 6 years, 6 months
  • Last seen more than 2 years ago
How can I display site logo, name and slogan?
Accepted answer
11 votes

function mytheme_preprocess_page(&$variables) { $site_config = \Drupal::config('system.site'); $variables['site_name'] = $site_config->get('name'); $variables['site_slogan'] = $...

View answer
How do I use absolute URLs?
Accepted answer
9 votes

1. Add Content: Link to Content field to your View . Your view fields will look as shown below. 2. Make sure that your Title field is outputted as plain text. In the Content:Title field settings ...

View answer
Overriding views-view-grouping.tpl.php when grouping by only one field
Accepted answer
6 votes

I've had the same issue. At first I though it was connected to the current theme I was using, but after testing with a few different themes I discovered that not to be the case. I still do not ...

View answer
Do default emails support HTML?
Accepted answer
6 votes

Out of the box (w/ core modules only) default account emails (and any other emails) that Drupal generates do not support HTML. Drupal converts all html emails to plain text before sending. You can ...

View answer
CSS order in Drupal 8 libraries.yml
Accepted answer
5 votes

You can create a separate library for external bootstrap stylesheet, which will give you flexibility to load bootstrap css before loading global-styling css. Here's how to do it: YOURTHEMENAME.info....

View answer
Loop through node reference
Accepted answer
5 votes

The Rule will react on event "After updating existing content of type Content1". The Rule will have to utilize a component in order to reach the email field in Content3. In short: Rule loops through ...

View answer
How can create a template for user login form?
Accepted answer
4 votes

Use page--user--login.html.twig for targeting user/login page. You can also enable Twig debugging to see naming suggestions for different page components. The markup of each Twig template is ...

View answer
Is there a way to use File Field but have it’s directory path be different for different instances of content, instead of the same?
Accepted answer
4 votes

You can define your file paths with node tokens. File (Field) Paths module provides the functionality that you are looking for. The File (Field) Paths module extends the default functionality of ...

View answer
How do I test if a field has a value in twig?
Accepted answer
3 votes

There is an issue about this on Drupal.org: Checking for empty fields in Twig templates is complicated. Use the following syntax and keep an eye on updates: {% if content.not_required|render %} ...

View answer
How do I see *which user* last updated a node?
Accepted answer
3 votes

Use Administration Views module to replace default content page for admins. Find new View created by that module and add Relationship - Content revision: User Then add field to your View "User: ...

View answer
Simplenews adds newsletters title at the top of the newsletter
Accepted answer
3 votes

Find simplenews-newsletter-body.tpl.php in modules/simplenews/theme folder. Copy it to your current theme's folder and open/edit it. You'll see that it has a $title variable printed at the top. ...

View answer
How to load aggregated styles / js in an 'external' script via DRUPAL_BOOTSTRAP_FULL?
Accepted answer
3 votes

Here's the gist of it (w/ commentary). <?php // ... your code drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); // get current theme and it's variables $current_theme = variable_get('theme_default','none'...

View answer
Add a relationship to logged in user, not content author, on content view?
Accepted answer
3 votes

There is no way to accomplish this via UI. At least not if the User field may contain multiple values. In the example below 'field_test' is a List(text) field w/ select widget (unlimited values ...

View answer
How to restrict node authors from commenting on their own nodes?
3 votes

You'd want to use hook_node_view_alter() in your theme to unset the comment form if the logged in user is same as node author. function yourtheme_node_view_alter(&$build) { global $user; ...

View answer
Show Node fields on Drupal Form
Accepted answer
3 votes

If your question pertains to Drupal 7 then you may want to take a look at the Entity Reference Autofill The Entity reference autofill module gives Entity reference fields an option to populate ...

View answer
How to get the NodeID from ItemID of connect Item from Field Collection
Accepted answer
3 votes

you may want to try hostEntity() method (link) Returns the host entity, which embeds this field collection item. Then you'll be able to extract nid from the result returned by hostEntity(). but ...

View answer
Limit Change to Read More Link in Node Teaser to One Content Type
2 votes

Add following to your THEMENAME.theme file /** * Implements hook_preprocess_HOOK() for node.html.twig. */ function THEMENAME_preprocess_node(&$variables) { // ... if ($variables['teaser'...

View answer
Send email to users, except author comments
2 votes

You can install Rules Conditional module, which will give you an option to run conditional logic inside a Rules Action, in your case related to the loop that you created. So, you'll do a check in ...

View answer
How to set the visibility rule for pane to not show up when any user is logged in?
Accepted answer
2 votes

While adding a Visibility rule to the pane, select User:Role and then select "anonymous". This way the pane will be shown only to anonymous (not logged in) users.

View answer
How To: Change Block Text Color
Accepted answer
2 votes

There can be multiple reasons why your styles are not applied to the page elements: CSS aggregation is enabled. Disable aggregation and see if your custom CSS works. If it doesn't, you probably ...

View answer
How to export path breadcrumbs
Accepted answer
2 votes

Features: Check if you have Path Breadcrumbs module checked in Features Settings (screenshot below). If it was checked and you still do not see it in the Features components list than something else ...

View answer
7 - Views Filter where one field equals Logged in User's Email field
Accepted answer
2 votes

Add your "Assigned to" field as contextual filter, and set "provide default value" to PHP code just like you were thinking, but change your php snippet to return a value instead of printing: global $...

View answer
How to allow all commerce customers to use their billing address as their shipping address, in Commerce Shipping 2.X?
Accepted answer
2 votes

Go to Checkout Settings (admin/commerce/config/checkout). Find Shipping Information pane and click configure. You'll see setting for copying billing address right there (screen below)

View answer
Drupal Commerce product in-cart status info in Views
2 votes

I am not aware of any modules, that will provide the functionality that you described out of the box, but the snippets below will probably get you moving in the right direction. You'd write a ...

View answer
Contextual filter for taxonomy terms
Accepted answer
2 votes

You can use "Taxonomy term: Parent term" as contextual filter in your view. Most likely you will need to provide a default value for the filter, such as "Taxonomy term ID from URL". Provide a ...

View answer
Comment permission settings
2 votes

AFAIK there are no modules that provide the functionality of 1), 2) & 3) out of the box. There is an awesome module Comment Permissions that can help you achieve better customization of comment ...

View answer
print image as a background-image
Accepted answer
2 votes

You are retrieving the absolute url of the file correctly, but your quotes in style attribute are a little mixed up. Try this: <?php print '<div style="background-image:url(' . $url . ');">...

View answer
Drupal Commerce Paypal WPS
Accepted answer
2 votes

PayPal WPS submodule of Commerce PayPal provides only one payment option, which redirects the user to PayPal for payment. Credit card icons are there to let users know that at PayPal's end they will ...

View answer
Second Product variant image in fb share is not coming
2 votes

[node:field-product:1:field_images] You'd add that in your metatag image field together with the first token that you mentioned, separated by comma. If fb is still not picking it up, after your ...

View answer
After saving a new comment How to fetch all comments for a given node?
Accepted answer
2 votes

If your rule reacts on event "After saving a new comment", add a Loop in actions section and select comment:node:comments as a selector. The loop will go through an array of comments from commented ...

View answer