Drupal 8 is the version of Drupal currently in development which will be the next major release.

learn more… | top users | synonyms (1)

4
votes
1answer
120 views

Why does Drupal say I need to upgrade to 8.0.0 beta 6 when I'm already checked out on that tag?

I followed the git instructions at: https://www.drupal.org/project/drupal/git-instructions to get Drupal 8 : git clone --branch 8.0.x http://git.drupal.org/project/drupal.git . I then checked out ...
0
votes
1answer
20 views

Add field to existing content entity

I am trying to add a hidden field to all nodes in my module (for any node type even new ones being created later on). Would this be the correct code? $field_storage = ...
0
votes
1answer
35 views

Theming stuff in Drupal 8?

How do you theme stuff in Drupal 8? In 7, for example, if you had some data items you could call item_list, via the theme function, pass in a render array and get your markup back. This is a great ...
1
vote
1answer
17 views

Get current node id in Drupal 8

In Drupal 7, if I wanted to get to get the node id of the currently displayed node (e.g. node/145) I could get it with the arg() function. In this case, arg(1) would return 145. How is the same thing ...
0
votes
0answers
14 views

form_alter and #element_validate inside .module file

Inside my .module file, I have created a hook for alter register_form and add a password field with a custom field-validation: function xenforo_form_user_register_form_alter(&$form, ...
1
vote
0answers
15 views

How to login to an external website after drupal-login?

I would like know how I can login my user to an external website after drupal-login please ? I use : $xenAPI = new XenAPI('http://xen.dev/api.php', 'MY_API_KEY', 'MY_API_KEYSALT'); ...
0
votes
1answer
19 views

How do I get a field translated in Drupal 8

I have a multilingual site in Drupal 8, and several node, some translated and others not. As I can programmatically get the translated field or by default they give it back from the original language. ...
0
votes
2answers
22 views

How do I find and alter the Views field markup in Drupal 8?

Below is a twig template: core/modules/views/templates/views-view-unformatted.html.twig: {# /** * @file * Default theme implementation to display a view of unformatted rows. * * Available ...
0
votes
0answers
24 views

Untrusted Host “localhost” in

From Drupal 8 beta 6 (released today), I have this error : Error message UnexpectedValueException: Untrusted Host "localhost" in Symfony\Component\HttpFoundation\Request->getHost() (line 1221 of ...
1
vote
1answer
21 views

Maximum function nesting level of '100' reached on Drupal 8

on all Drupal 8 beta, I have this error: Maximum function nesting level of '100' reached It's a problem with Drupal 8 or my server config please ? How I can fix this error for work with Drupal 8 ...
4
votes
2answers
33 views

Will Drupal & Drupal Commerce run under php-cgi?

For some specific reasons (experimental setup - not Apache nor nginx) want run Drupal under php-cgi (not fast-cgi). The site should serve an very-small e-commerce site - probably Drupal Commerce. ...
0
votes
0answers
26 views

Insert a block into a template

How a block already created (with Views) I could insert into my template (mytemplate.html.twig)?
-1
votes
1answer
28 views

How do I print a image field in node.html.twig with a image style? [on hold]

How do I print a image field in node.html.twig with a image style?
0
votes
0answers
17 views

How to build/overwrite a menu with all secondary items all time expanded? [on hold]

I want to build a superfish menu. How to print always the second level below the main menu items and not using the backend with the menu item setting "Show as expanded"? Thanks and regards ...
0
votes
1answer
30 views

Access menu links from a module

I'm trying to display a menu in my module. I've used \Drupal::entityManager()->getStorage('menu')->load('oz-topbar-menu'); which allows me to get the title of the menu, the description, etc. I ...
6
votes
1answer
153 views

What does “The provided host name is not valid for this server” mean?

I am running a Drupal 8 website, and when I browse to any page, I am getting a plain white page with just The provided host name is not valid for this server. on it. What does this mean? How ...
0
votes
1answer
22 views

How do I hide the page title based on node type using template_preprocess_page()?

In Drupal 7, this was possible. (See How to hide page title based on node type using template_preprocess_page().) function MYTHEME_preprocess_page(&$variables) { if (!empty($variables['node']) ...
0
votes
1answer
26 views

Create themable field group

I have a custom entity with several fields. Now I would like to group the fields and give each group it's own twig template so that I would be able to compose a page (my custom entity) containing ...
5
votes
1answer
61 views

Remove filter formats help text

In D6 and D7, with a simple form_alter you could unset $element['format'], but now the format help and the format tips are added in a #process method. How can I remove them?
0
votes
1answer
20 views

D8: {{ dump( page ) }} in page.html.twig gives blank page (WSOD) [on hold]

Why? And is there an alternative approach without "Devel" (in older times a simple var_dump was the solution)? Thanks and regards
0
votes
1answer
23 views

Add fields to Drupal 8 form registration, and get plain password for use with external website

I would like know how I can custom the default registration form and how get the user plain password please. I use HOOK_form_user_register_form_alter for add my custom fields, by example: ...
0
votes
1answer
28 views

How do I get the router name from the internal path in Drupal 8?

If I know the internal path of my page (e.g. 'node/1') how do I get the router name? I need it it to generate an internal url: $url = Url::fromRoute($router_name); I found Url::getRouteName, but ...
0
votes
0answers
35 views

Drupal 7 to 8 Module Port: time for a new class? [closed]

I'm porting the Node Hierarchy module from D7 to D8, and I'm seeking advice on a major chunk of the code. Node Hierarchy provides a parent/child relationship between nodes, and provides hierarchical ...
1
vote
1answer
46 views

How do you create a link in Drupal 8?

Say I am extending The blockBase class to create a custom block, and I am implementing the blockBuild method to create some markup for my block. Something like this: class YourModuleBlock extends ...
3
votes
2answers
65 views

How do I access a field value in a node object?

node_load((int) $nid) loads a fully-populated node entity. $node->title->value gets the title, but how do I access field values in Drupal 8?
0
votes
1answer
29 views

Custom node field type should also support content blocks in D8 - what to do?

I'm using https://www.drupal.org/project/paragraphs for nodes. "Paragraphs module comes with a new "paragraphs" field type that works like Entity Reference's. Simply add a new paragraphs field on any ...
1
vote
1answer
20 views

Hook inside class

I would like know if it's possible to use hook inside a class and inside .module file. By example : modulename.module <?php use Drupal\xenforo\Xenforo\XenAPI; use ...
1
vote
1answer
26 views

Extend Drupal 8 User Profiles

I need to build a module to handle Users profiles, and need to extend automatically the basic Drupal user object upon installation. For Drupal 7 I found a way with: field_create_field($field); But ...
0
votes
1answer
52 views

How do I test my code in Drupal 8?

I created a Drupal 8 module and I would like know what is the best practice for testing my code? For example, if I use hook_user_login(), how I can try my code without login/logout every time and how ...
3
votes
1answer
24 views

Scope javascripts to be outside admin

Now when we are almost there using purely YML files to include JavaScript, is it possible to include javascripts everywhere except for in the Drupal administration? Beta 4 does not allow the #attached ...
3
votes
1answer
118 views

Are Drupal 8 configs written and read directly to/from .yaml file or still to the database?

Background Drupal 7 and previous versions have attracted criticism for Drupal web site admin configuration being stored in the MySQL database, the criticism being that being in a database means that ...
1
vote
1answer
30 views

Block loading behaviour in Drupal 8 in a performance sense through the visibility settings

The following scenario: - i have for example a standard block region through a pages of a site: "highlights" - for the frontpage i have an additional region: "highlights_frontpage" - i put a block ...
1
vote
1answer
37 views

Ajax button in admin

So I figured I'd create a configuration for my module. I created a normal form with some fields to let the users configure the module with variables. I also added a button which would do an ajax-call ...
0
votes
1answer
36 views

Adding an image base field to custom content entity

consider the following situation: I have created a custom content entity with several base fields (string and string_long fields) and it works flawlessly. In addition I want the entity to hold an ...
3
votes
1answer
81 views

Replace Standard Node Path in Drupal 8

I am still new to all the Symfony semantics. What would be the easiest way to change node canonical urls to be /article/[node-title] instead of /node/[node-id]? Following this documentation I tried ...
0
votes
1answer
36 views

Get taxonomy terms

I wanted to retrieve taxonomy terms from a certain vocabulary in Drupal 8. Apparently I can still do it using taxonomy_get_tree but it's deprecated. I now have to use TermStorageInterface::loadTree ...
0
votes
0answers
28 views

Contextual links for custom blocks: Add “Edit block content”

has somebody an idea, how to customize the contextual links in D8? I have created a custom block type and it would be wonderful to have a link in the contextual links menu: "Edit block content".
0
votes
0answers
35 views

How do I programmatically (via plugins, hooks) add taxonomies to menu in Drupal 8?

I have a configured view to display nodes by a taxonomy term id. How do I add taxonomy links (/taxonomy/term/1, /taxonomy/term/13) to "Main navigation" menu programatically? What plugins (hooks) ...
0
votes
0answers
47 views

How can i return data from .html.twig and put it into textarea using submit with ajax (Drupal 8)

//*****************TestForm.php*****************// public function buildForm(array $form, FormStateInterface $form_state) { $form['name'] = array( '#type' => 'textfield', ...
-2
votes
2answers
34 views

What is proper way to update D8 DEV? [duplicate]

I'm not having any luck with Drush (just hangs) to update a (non-production) D8 site, dev branch (from around beta2) to Head. How would one manually update the files db/config?
0
votes
0answers
31 views

Drupal 8 User Registration with REST

How do you register a user account via REST in Drupal 8? Here's how far I've made it (not sure if this is the right direction though): I've enabled the Form mode resource under ...
-1
votes
1answer
162 views

Parse error: syntax error, unexpected '[', expecting ')' in C:\xampp\htdocs\drupal-8\core\vendor\react\promise\src\functions.php on line 62

I have just installed drupal 8 development version (drupal-8.0.x-dev) but while running it in my web server I am getting this error Parse error: syntax error, unexpected '[', expecting ')' in ...
0
votes
0answers
35 views

How to add menus to my footer block (nested blocks)

I created a module in Drupal 8 called Footer and made it a block so I can include it in my Footer region in my theme. I need my footer to have two menus, one listing topics and one listing static ...
3
votes
1answer
41 views

Can I register an additional namespace to point to the modules folder

In Drupal 8 is it possible to register an additional namespace which points to the modules folder in addition to the \Drupal namespace? e.g.: MyOwnNamespace\{module_name} to point to ...
3
votes
1answer
60 views

Is it possible to use a replacement kernel without hacking core?

I'd like to use a replacement DrupalKernel. It looks like the default is hardcoded into index.php, despite the existence of DrupalKernelInterface: $kernel = ...
6
votes
2answers
176 views

Sub folders and how to namespace classes

In Drupal 7 I can have a module inside another module. Is this still the case in Drupal 8 and how would I namespace classes inside the sub module? Another thing I can do in Drupal 7 is to create sub ...
0
votes
1answer
39 views

How to autoload classes from a 3rd party PHP library in Drupal 8

I would like to use a 3rd party PHP library in my module and I wanted to ask what I need to do to autoload the classes? Example: Drupal\my_module\MyClass wants to instantiate ...
0
votes
1answer
51 views

Upgrading drupal 8 beta3 to beta4 table user__roles not exists

When I upgrade my drupal site to beta4 release, it says that table user__roles is not exits. It's look like that new beta version alter table name from users_roles to user__roles. how is possible to ...
4
votes
1answer
54 views

Get entity id in hook_form_BASE_FORM_ID_alter()

I am working on porting a D7 module to D8. As in Drupal 8 all things are represented as entity, menu items are also represented as entity. Now I added a hook_form_BASE_FORM_ID_alter() implementation ...
1
vote
2answers
64 views

Drupal 8 Theme Header Background Image Upload

I'm upgrading the Mayo theme to Drupal 8. For Drupal 7 it worked like this in theme-settings.php with hook_form_system_theme_settings_alter(): $form['adv_header']['header_bg'] = array( '#type' ...