Getting variables in Drupal 8 is now as short as \Drupal::state()->get(‘variable_name’, ‘default_value’)
Here’s how you get node abs url in D8: \Drupal\Core\Url::fromRoute('entity.node.canonical', ['node' => 1], ['absolute' => TRUE])->toString()
#Drupal 8: to get user fields U type this combo: \Drupal\user\Entity\User::load(\Drupal::currentUser()->id()); Try not to break your fingers
"Never memorize something that you can look up." - Albert Einstein... #Drupal 8 I'm looking at you!
In D7 drupal_get_form(‘user_login’) was too short, so got replaced by \Drupal::formBuilder()->getForm(Drupal\user\Form\UserLoginForm::class)
Snippet: How to check for user access or permission in Drupal 8
1 2 3 4 5 6 7 |
|
How To Disable #Drupal 8 caching during development https://www.drupal.org/node/2598914 Definitely Drupal 8 isn’t the most developer friendly thing now…
ES6 For Django Lovers - https://www.caktusgroup.com/blog/2016/05/02/es6-django-lovers/ #js #python #django
Most read posts
- How To Remove Format Options / Guideliness From Comments Textarea in Drupal 7 (790416)
- How to programmatically create nodes, comments and taxonomies in Drupal 7 (333376)
- The 11 Most Important Things To Do After You Install Drupal 6 (262255)
- How To Create an Ajax Autocomplete Textfield In Drupal 7 (219426)
- Five Drupal Distributions. Overview (144379)
Recent posts
- How to check for user access or permission in Drupal 8
- JQuery.cookie in Drupal 7
- Default Search API Sorts Per View in Drupal 7
- Creating Custom Template Filter That Injects Adsense Ad Code After N Paragraph in Django
- Elasticsearch fails with error "This can result in part of the JVM being swapped out. Increase RLIMIT_MEMLOCK (ulimit)". What to do?