Questions tagged [drupal-8]

Drupal 8 is the Drupal version that was officially released on November 19, 2015. Rather than using this tag, consider posting your question directly on https://drupal.stackexchange.com/.

Drupal 8 introduces major changes, such as the support for HTML 5, better support for web services, multi-language support, mobile devices, and a configuration API.

Use this tag only if your question relates specifically to this version.

Requirements

  • Web server: Apache, Nginx, or Microsoft IIS
  • Database server: MySQL 5.5.3/MariaDB 5.5.20/Percona Server 5.5.8 or higher with PDO and an InnoDB-compatible primary storage engine, PostgreSQL 9.1.2 or higher with PDO, SQLite 3.6.8 or higher
  • PHP: PHP 5.5.9 or higher

Related tags:

Resources

2837 questions
28
votes
9 answers

Creating a link from node ID in Drupal 8

I am checking out Drupal 8 and try to generate a link based on the node ID of an article. In Drupal 7 it is something like: $options = array('absolute' => TRUE); $nid = 1; // Node ID $url = url('node/' . $nid, $options); This results into an…
Nicensin
  • 943
  • 1
  • 6
  • 15
27
votes
7 answers

Drupal 8 images with image style

In drupal 7, i use function image_style_url('style', uri) to generate new image with style and return image's path. so what will be instead of it in drupal 8? thanks
user3810914
  • 425
  • 2
  • 5
  • 9
25
votes
4 answers

How to throw 404 error in Drupal module?

I need to throw 404 error in module. Or may be there are any possibility to set required option for menu hook?
webbear
  • 429
  • 1
  • 6
  • 12
23
votes
2 answers

'Twig_Error_Syntax' with message 'Unknown "render" filter

I'm running drupal 8, composer and npm to perform gulp tasks. When I run npm start.. my task manager: I get the following stack trace: Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unknown "render" filter.' in…
cwiggo
  • 2,541
  • 9
  • 44
  • 87
22
votes
8 answers

How to use docker with drupal and drush?

I'd like to use drush. It needs to run in the drupal container. There's also a drush docker repo. But I have no clue how to make it available whithin the drupal container. It's my first docker and drupal project, so maybe I'm getting things…
citizen404
  • 1,485
  • 1
  • 10
  • 19
22
votes
11 answers

Extract Url & Title from link field in Drupal 8?

I'm trying to retrieve the URL and the Title values of a Link field in Drupal 8. In my custom controller, I retrieve the nodes with: $storage = \Drupal::entityManager()->getStorage('node'); $nids = $storage->getQuery() ->condition('type',…
Kevin Wenger
  • 1,484
  • 1
  • 13
  • 29
17
votes
2 answers

Get cookie from Twig template

I'm trying to access cookies I set in my Drupal website. I created two cookies on a form submission : with the Drupal funtion = user_cookie_save(['myfirstcookie' => 'myfirstdata']) with the classic PHP function = setcookie('mysecondcookie',…
Dadaz
  • 171
  • 1
  • 1
  • 4
17
votes
9 answers

Drupal 8: delete all nodes of the same type

I have a need to remove all nodes of the same type in Drupal 8 (there are over 7k of nodes). It wouldn't be a problem for Drupal 7 (DB query + node_delete or node_delete_multiple would have solved my issue). However, D8 is slightly different …
megastruktur
  • 593
  • 1
  • 7
  • 9
15
votes
2 answers

Cesium in Drupal: Load Viewer on a Page in Drupal

IMPORTANT NOTE When instantiating the Cesium Object in a normal project, it does not have any properties that are prefixed with underscores (_dataSourceCollection, _dataSourceDisplay, etc). When instantiated in Drupal, however, about 40-45…
Emmanuel Buckshi
  • 558
  • 1
  • 7
  • 23
15
votes
5 answers

How do I programmatically create a node?

I'm designing a new module in Drupal 8. It's a long-term project that won't be going public for a few months at least, so I'm using it as a way to figure out what's new. In this module, I want to be able to programmatically create nodes. In Drupal…
chapka
  • 490
  • 1
  • 3
  • 11
13
votes
5 answers

How do you check if a field is empty in drupal 8?

I have a field added to the content type of basic page. It is a select box, which is either checked or unchecked depending on whether or not the page is of the 'getting started' kind. I want to add the class 'getting-started' to the body element in…
ljolz
  • 216
  • 1
  • 3
  • 8
12
votes
5 answers

How to clear cache programmatically in Drupal 8?

I am working on a Drupal 8 site. This site was working. I recently moved to another machine. It is showing errors like: Recoverable fatal error: Argument 1 passed to Drupal\Component\DependencyInjection\Container::__construct() must be of the…
Pupil
  • 23,834
  • 6
  • 44
  • 66
12
votes
4 answers

What way to debug ignored items in Drupal 8 migration

I create migration script with migrate_upgrade module, but i have a lot of ignored items while migration, i tried to use drush mmsg from migrate tools but its not help with ignored fields only with failed.
Igor Taldenko
  • 133
  • 1
  • 5
12
votes
3 answers

How to create a query in Drupal 8

I am used to using db_select in drupal 7 but now it's deprecated in drupal 8 So, If I need to create a query to list all users from users_field_data table, What should I do? Do I still use db_select or db_query even though they are deprecated…
Mina Atia
  • 780
  • 1
  • 4
  • 13
12
votes
4 answers

How to use an image style in a Drupal 8 twig template?

I am trying to print an image using an image style that I've created in my drupal 8 theme. I can print an image in a template by doing {{ content.banner }} but how do I apply the image style to that image? I tried looking for documentation but there…
Tyler Marshall
  • 314
  • 2
  • 5
  • 15
1
2 3
99 100