Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 55847

Version tags should be used for questions that apply to a version only, not to merely say what version a site is using.

0 votes

The use of contexts in a Drupal.t() function in Javascript

For performance, Drupal do not load all translation string into Javascript. It need to specifically identify the translation string exists in a Javascript to load. Then the locale module will load you …
Koala Yeung's user avatar
0 votes
1 answer
785 views

How do you get the current directory in a command method?

In a standard Drupal 8 environment, the current working directory is override and becomes the document root of the site. …
0 votes

Add column to custom field schema

This is a function I wrote to add new field(s) to existing field tables. /** * Add a new column for fieldType. * * @param string $field_type ID of the field type. * @param string[] $new_fields …
Koala Yeung's user avatar
1 vote
1 answer
814 views

Custom form password validation / strength enforcement

I have a custom form that would create user. The form is rendered with Form API and is using PasswordConfirm element, but it doesn't seem to validate the password against the default password rules (e …
0 votes
0 answers
175 views

How to get a product variant field (not attribute) value?

I have created a product variant with 1 attribute (say "Subscription Plan" or attribute_sub_plan) and 1 field (say "Number of Issues" or field_num_issues). The attribute was for human readability whil …
0 votes
0 answers
63 views

Is there a way to attach HTML in <head> after the css links?

We currently can add HTML attachment to the <head> section like this. function mymodule_page_attachments_alter(array &$page) { $page['#attached']['html_head'][] = [ // some HTML declaration ]; …
1 vote
2 answers
839 views

Memory efficient way to load large entity set for data export

I'm working on an Excel exporting feature in a Drupal 8 site. …
2 votes
1 answer
431 views

How to bootstrap a custom script and retrieve the session object?

I'm writing a custom script that requires a proper Drupal 8 user session to work. This is the current version: <? …
1 vote
Accepted

How to bootstrap a custom script and retrieve the session object?

This is the code I came up with in the end. It works. Feel free to suggest a more concise version :-) <?php use Drupal\Core\DrupalKernel; use Symfony\Component\HttpFoundation\Request; $drupal_root …
Clemens Tolboom's user avatar
1 vote
2 answers
1k views

How can I make a response cachable by browsers?

I am working on a Drupal Controller implementation that would return a generated image as response. I used Symfony's Response and I was trying to add ETag header to it: use Drupal\Core\Controller\Con …
1 vote
Accepted

How can I make a response cachable by browsers?

Thanks to 4k4's answer. I took a deeper dive into the issue. Here is something that might benefits others who want to do the same thing. ETag Header Setting The class FinishResponseSubscriber will c …
Koala Yeung's user avatar
1 vote
1 answer
3k views

Running drush entity:updates claimed successful but not changing anything

I am working on a project with custom entity type. My module works fine in my local environment. But when I deployed to my staging site, things are strange. For instance, I tried to change my entity …