Search Results
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 |
Version tags should be used for questions that apply to a version only, not to merely say what version a site is using.
61
votes
Accepted
Get all nodes of given type
You can use Drupal::entityQuery() & Node::loadMultiple() to load all the nodes of your given type:
$nids = \Drupal::entityQuery('node')
->condition('type','my_custom_type')
->accessCheck(FALSE)
…
37
votes
Accepted
How can I get the node ID from a path alias?
I'm not sure if there's a direct function, but one route is to use the path alias manager service to lookup the internal path then regex it for a valid node id to perform an object load on:
$path = \D …
34
votes
Accepted
Release cron lock
It's now in the semaphore table with the key name "cron". This can be removed via
drush sqlq "DELETE FROM semaphore WHERE name = 'cron';"
Or, if you can execute PHP in Drupal bootstrapped environment …
33
votes
Taxonomy term name as contextual filter for view
The Term name converted to Term ID filter looks to be missing for D8 Views.
One site-builder workaround, is to add a Relationship, Taxonomy terms on node then to add a Taxonomy Term: Name filter to …
22
votes
Accepted
Is Drupal Console aimed to replace Drush?
Ten things you need to know about Drupal Console coming from Ray Saltini of FFW (the company supporting the lead developer Jesus Olivas of Drupal Console), & Drush and the Drupal Console with Drupal 8 …
18
votes
Accepted
Removing all 'stable' theme's CSS from a Drupal 8 custom theme
There's no wildcarding for the stylesheets-remove (FYI: there's a FR out there for it). However, you can use libraries-override to remove the library associated with the all CSS components you've high …
18
votes
Accepted
Delete a node after X weeks it was created
If you're looking for a developer-centric solution, you can invoke hook_cron() in a custom module to clean up old nodes:
function MYMODULE_cron() {
// Other conditions can be altered/added as neee …
15
votes
Accepted
How can I remove preview button from contact form?
A custom module can utilize hook_form_alter() to strip out the preview button form element in any form:
/**
* Implements hook_form_alter().
*/
function MYMODULE_form_alter(&$form, $form_state, $for …
15
votes
Accepted
Drupal 8 maintenance page theming
In Drupal 8, settings.php contains the following line:
# $settings['maintenance_theme'] = 'bartik';
First, uncomment this setting and change "bartik" to the machine name of your custom theme. …
11
votes
Accepted
More filter options on admin/content
Now that Views is integrated into Drupal 8, the admin/content display can be driven by a customizable View. …
9
votes
How do I programmatically place a block?
To provide a plugin block you can build an array of settings and pass it off to \Drupal\block\Entity\Block::create() to create the Block object and save the instance.
For example if you wanted to add …
9
votes
Accepted
Take over display of a content type node route
You'll need to alter the entity.node.canonical route to do this. You can do this via a RouteSubscriber::alterRoutes() in a custom module to have the route driven by your custom logic. In src/Routing/R …
9
votes
1
answer
9k
views
Drupal 8 maintenance page theming [closed]
I want to customize the maintenance page in Drupal 8.
How do I theme it? …
8
votes
Accepted
How do I use Path Matcher for front page?
Your code is assuming that the request URI for / will retrieve /node on the getAliasByPath() method call. It won't. Setting the Drupal front page isn't the same as setting a path alias in the Path mod …
8
votes
Programmatically get all names of an entity reference field
An entity reference field, by definition, can only target one entity type so you can know what your target type is by calling up getSetting() on the field definition.
// Print the targeted entity typ …