How do I use a custom twig template with a render element?

How do I use a custom twig template with a render element?

I am fairly new to Drupal 8 module development, so I decided to follow a tutorial at https://docs.acquia.com/articles/drupal-8-creating-elements-theming-elements-and-managing-frontend-libraries, which describes the process of setting up a module with a render element... read more
How do I use a custom twig template with a render element?

How to add extra data to a programmatically created node

Using Drupal 8 i am importing data from an external source and creating the node programmatically from the controller: $node = Node::create(array( ‘type’ => ‘article’, ‘title’ => ‘some title’ )); $node->save();... read more
How do I use a custom twig template with a render element?

Get current language in template

In Drupal 7 the current language is a global variable we can access with global $language; $langcode = $language->language; I want to know how can we access the current language in a Twig file in Drupal 8 (in page–front.html.twig for example)? read more
How do I use a custom twig template with a render element?

Using computed field value in Rules

I’m using Commerce module and I have a line item with a computed field that’s calculating a date. This field finally shows a date. Then during the checkout process I have a form with a Date field (part of the Order). I’m running some Rules and... read more
How do I use a custom twig template with a render element?

Returns 403 error after user login

My site was copied from production to test server. It works on Drupal 7 + Nginx + PostgreSQL. On production, user login works fine, but on test server I receive a 403 error on users/admin (or user/1) where I’m redirected after login. What I’ve already... read more
How do I use a custom twig template with a render element?

Showing both original base price and calculated price (inc. taxes), when using two price fields and rules

Building a webshop for customer with Drupal 7 + commerce. I’ve defined two price fields for commerce product entity: 1) base price (excluding tax) that is wholesale price 2) retailer price (excluding tax) There is a rule with a condition “current user has... read more
How do I use a custom twig template with a render element?

PDOException : SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘registration

Using: commerce+entity registration+commerce registration During the checkout sequence, after completing the registration step, I get this fatal error: PDOException : SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry... read more
How do I use a custom twig template with a render element?

Default value for form_system_theme_settings_alter

I’m trying to set some theme settings, and I can’t figure out how to have my settings get their default value, which should be obviously the currently set value. Here’s an example: $form[‘navbar_layout’] = array( ‘#type’ =>... read more
How do I use a custom twig template with a render element?

Decryption failed because the HMAC could not be validated while decrypt

I am using the Encrypt module to encrypt some of user object data. I can encrypt data, but while decrypt it, I get the following error: Decryption failed because the HMAC could not be validated encrypt(‘name’) // It works. decrypt(‘some encrypted... read more
Install without Bootstrap CDN

Install without Bootstrap CDN

I have the theme Bootstrap CDN 3.3.6 installed on my site and I use the appearance “Journal”. How not to use the CDN maintaining the appearance “Journal” ? Thank you I download on Bootstrap http://getbootstrap.com/getting-started/#download and... read more
How do I use a custom twig template with a render element?

How to delete children when main entity is deleted?

I am looking for the best way to delete children of my main entity when i delete it. I have 2 entity type : commandes_entity commandes_ligne_entity ( entity reference to commandes_entity ) The only way i have found is to create a hook_entity_delete : Edit : This is... read more
How do I use a custom twig template with a render element?

Implementing preprocess function for custom template

In Drupal 7, I’m creating thank you page for a custom form and have following in my mymodule.module: function mymodule_menu() { $items = array(); $items[‘mymodule/thank_you/%’] = array( ‘title’ => ‘My Module Thank You... read more
How do I use a custom twig template with a render element?

Programmatically create a comment form for a node

I’m trying to port a theme from Drupal 6 to Drupal 8, and I find code like the following. $edit = array(); $edit[‘nid’] = $node->nid; $form = drupal_get_form(‘comment_form’, $edit)); How do I load the form in Drupal 8? I get the... read more
How do I use a custom twig template with a render element?

How can I retrieve the value of a configuration object from a template?

I have a module that sets the value of a configuration object. I don’t know how to retrieve that value from a template file. In Drupal 7 I just needed variable_get() to get the value. What equivalent code should I use in Drupal 8? read more
How do I use a custom twig template with a render element?

#states hide by radio won’t work

The problem is all in the title. So here is my code (i cut some part to make it more visible) : Constructor : public function __construct() { $user = DrupaluserEntityUser::load(Drupal::currentUser()->id()); $this->sub_forms[‘user’] =... read more
How do I use a custom twig template with a render element?

How to send a vote using Advance Poll and Services Voting Api?

I need to expose a poll to a mobile app. After doing some research I found out that I could receive the votes, through a web service, using the services_votingapi module, and the go-to poll to use was advpoll, or Advance Poll. I’ve made a poll with several... read more
How do I use a custom twig template with a render element?

How to set and inherit variables within different twig templates?

I’d like to set a variable in my node.html.twig template: {% set title = label %} {{ content }} The content consists of one field visible only, which has it’s own template: file-link.html.twig How can I access the title variable of the node template in the... read more
How do I use a custom twig template with a render element?

How do you programmatically create a webform with a managed_file type?

I haven’t been able to find a single example of how to create a webform with a managed_file type. The webform initially had the type ‘file’, but needs to be changed to accept multiple attachments. When the type is changed to... read more
How do I use a custom twig template with a render element?

How can I get the URL to the public files directory?

I can get the path to the public files directory by using Filesystem::realpath: $path = $filesystem->realpath(‘public://’); But how can I get the URL of public://? read more
How do I use a custom twig template with a render element?

How to attach a CSV file with the Google Chart API?

I have created a Google Chart based View and it is working nicely. How to give the facility as the user should be able to upload a CSV file and the data comes accordingly? read more