New answers tagged 8
0
votes
How to update a views exposed filter programmatically?
In addition to checking the operator in the if statement "==" vs "=", the following should work. Note, the method overrides any existing filters hence the use of array_merge .
$...
1
vote
How to update a views exposed filter programmatically?
If you see above code there is syntax mistake use "==" operator:
if ($exposedInput['a'] = 'apple') {
Correct syntax:
if ($exposedInput['a'] == 'apple') {
if the dependent filter field 'b'...
0
votes
Modal does not handle errors on login
Here is snippet code to display the error message in popup: (Core: Login form)
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
use Drupal\Core\Ajax\...
0
votes
Remove a button from CKEditor based on the role of the current user
I had the same problem and was able to solve it with the hook_editor_js_settings_alter hook.
In "editorSettings" > "toolbar" I removed the entry for the "Source" ...
0
votes
How do I theme a modal popup?
Have you tried this?
On your custom module, add a file
custom_module.module
If you already have that file, edit it, and add this
function custom_module_theme() {
return array(
'twig-template-...
-2
votes
How do I set the title tag for the maintenance page?
If you have access to the backend, you can modify the string directly for a temporary change. Change /var/www/html/ to the location of your install and other strings to fit your needs.
Login with SSH....
0
votes
Local drush stops working after changing files and folder permissions
Sometimes help just this:
rm -rf vendor
composer install
Community wiki
0
votes
Hide block on 404 (not found) page
programmatically:
$route_name = \Drupal::request()->attributes->get('_route');
if ('system.404' === $route_name) {
$region_name = 'content';
$block_names = ['oneBlockID', 'andAnother']...
2
votes
Query webform submissions
Remember to include accessCheck(FALSE) or you won't get any result.
$query = \Drupal::entityQuery('webform_submission')
->condition('uid', $uid)
->accessCheck(FALSE);
$result = $query-&...
0
votes
How can I reference previously imported media entities?
What I did that work:
field_hero_image/target_id:
-
plugin: migration_lookup
migration: previous_migrate_media_image
source: node_uid
-
plugin: skip_on_empty
method: row
message: 'nid is ...
0
votes
How to update payment status inside an order?
It should be like below:
$payments = \Drupal::entityTypeManager()->getStorage('commerce_payment')->loadByProperties(['order_id' => $order_idS]);
0
votes
Exposed date filter that uses "Is between" doesn't include end date
This issue is also solved by the patch provided in https://www.drupal.org/node/2982968
0
votes
How do I access $this in a dataProvider method?
I hit this problem today as well, and it seems you are correct in your assumption from the comments that properties initialized within setUp() are not available in the data provider. According to the ...
0
votes
Install and enable 'Real AES' module: Dependency with Defuse PHP-encryption library
Founded solution:
Download Ludwig - https://www.drupal.org/project/ludwig
Install module and go to admin/reports/packages - https://www.drupal.org/docs/contributed-modules/ludwig/installation-and-...
0
votes
How to add module libraries to the page through an admin page?
Replace:
js:
path/to/library/file1.js
With
js:
path/to/library/file1.js: {}
0
votes
How do you programmatically include an entity type to a workflow?
This is now entityTypeManager rather than entityManager:
// Add bundle to default workflow
$workflow = \Drupal::entityTypeManager()->getStorage('workflow_type')->load('workflow_id');
$...
0
votes
Override user login form template
In addition to Yuseferis answer:
I'm using this function to add theme suggestions for forms in Drupal 10:
/**
* Implements hook_theme_suggestions_HOOK_alter() for form templates.
*
* Make forms ...
Top 50 recent answers are included
Related Tags
8 × 15791theming × 2498
views × 1971
entities × 1652
forms × 1389
nodes × 860
users × 642
blocks × 641
hooks × 538
ajax × 453
webforms × 448
i18n-l10n × 433
taxonomy-terms × 430
migrations × 404
configuration × 397
media × 394
database × 392
commerce × 391
caching × 386
navigation × 371
routes × 357
javascript × 342
files × 316
composer × 278
paragraphs × 263