Drupal 8 is the version of Drupal currently in development which will be the next major release. Avoid using it as the only tag, unless your question is only specific to this version, and does not involve non-core features, or core features that already have their tags.

learn more… | top users | synonyms (1)

0
votes
0answers
7 views

Multiple level of tab in Drupal 8

I want to have tabs but since they need to be dynamic so I am making use of local tasks.In the class extending DeriverBase I have written following function: public function ...
1
vote
0answers
13 views

Problem installing Drupal 8 in local “The translation server is offline”

I'm trying to install Drupal 8 on my laptop (localhost wamp server), and I allways get the folloging error in the first steps: Requirements problem The translation server is offline. The ...
0
votes
0answers
18 views

How do I write a Drupal 8 modal button

So I'm trying to open a modal via a button in Drupal 8 beta 11. I've patterned my code after some I found in BlockListBuilder.php in core, but I can't seem to get it to work. My routes are correct ...
0
votes
0answers
10 views

How to use tabledrag within multiple tables

I have a form that has three groups of elements which are presented via tabledrag form element. I would like to be able to move the rows between the tables, so not just within a single table as ...
0
votes
1answer
16 views

Drupal8 - what is the new Drush command that replaces 'drush variable-set'

In Drupal 8 the Drush command drush variable-set no longer works. From reading (here) it appears that Drupal 8 has a new "configuration" system that replaces the old (Drupal <=7) "variables". But ...
1
vote
1answer
24 views

“This version is not compatible with Drupal 8.x and should be replaced.”

The below theme files, which are the only files I have in my theme folder called 'Lychee', throw the error (in the 'Uninstalled themes' section of /admin/appearance): This version is not ...
0
votes
1answer
42 views

Altering CSS markup

I would like to add custom property on drupal's stylesheets <link /> tag. I tried following in hook_css_alter: foreach ($css as &$style) { $style['#attributes']['property'] = ...
0
votes
1answer
20 views

How do I get $form_state from hook_entity_update()?

I've manipulated the edit node form via hook_form_BASE_FORM_ID_alter() to insert a select pull-down menu. In my module, I've implemented hook_entity_update() to fire when the edit node form is ...
0
votes
1answer
18 views

Why would an error persist after after uninstalling the module?

I created a module for Drupal 8 and when I try to add it to the menu it throws this error Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ...
1
vote
3answers
73 views

How do I get the content type name using code?

I'm working on Drupal 8 and I want to get content type machine name and label. Here is my code: $cont_type = node_type_get_types(); foreach ($cont_type as $key => $value) { $label = ...
1
vote
1answer
29 views

Redirect to custom page after node save or delete

What I'm trying to do doesn't work, I still get redirected to /node/{id}: function hook_form_alter(&$form, $form_state, $form_id) { $form['actions']['submit']['#submit'][] = ...
1
vote
1answer
29 views

Context aware plugins

I am working on porting a module from Drupal 7 to Drupal 8. In the process I have to port a ctools content type plugin to the new context aware plugin. The legacy plugin had "node" as a required ...
1
vote
0answers
29 views

Alter an existing form

We just starting out with Drupal 8 and very quickly we ran into our first problem. What is the best way to alter an existing form in Drupal 8? We need to alter the save method for the node form to ...
0
votes
1answer
28 views

How to add custom settings / attributes to a field

I want to be able to add custom settings / attirbutes to field instances. I can create a custom field with custom settings no probs, but is it possible to get rid of the custom field and just add the ...
0
votes
0answers
17 views

Cannot redeclare conf_path() error on OS X [closed]

On Drupal 8 beta 10 and 11 on OS X (macbook air), I have this error : Cannot redeclare conf_path() Fatal error: Cannot redeclare conf_path() (previously declared in ...
0
votes
1answer
19 views

validate a base field in a particular content type

Since title field is considered as base field in Drupal 8, I opted hook_entity_base_field_info_alter to add validation to it. But when I look at that hook. ...
0
votes
0answers
17 views

Display menu tab only based on converted parameter

I have added a node/{my_menu}/mytab using the code in following question: Parameter upcasting in Drupal 8 with Form Controller After implementing ParamConverter class, I have added following code to ...
0
votes
1answer
30 views

How to add an 'operations' link to a custom route in Drupal 8?

I'm implementing a custom entity with bundles in Drupal 8. In the list of bundle entities page (i.e. equivalent to Node's Content Types listing page), I would like to provide an extra option to the ...
1
vote
2answers
32 views

Using arguments in addConstraint() for validation

I implemented hook_entity_bundle_field_info_alter() to add validation to fields of a node type. I got $bundle as an argument in the hook and I need to pass it in $options argument like below: ...
4
votes
3answers
60 views

What is the right way to force a session start?

I'm currently porting SimpleFBConnect module to Drupal 8. This module uses Facebook PHP SDK which expects that we have established a session before the user is redirected to Facebook for ...
0
votes
1answer
18 views

Using getThirdPartySetting() to get node type configurations in other hooks

In a Drupal 8 instance, getThirdPartySetting() function to save node type configurations using the NodeTypeInterface object like below $type = $form_state->getFormObject()->getEntity(); ...
0
votes
1answer
21 views

Is it possible to override configuration with yml files?

Override configuration guide shows how users can override configuration with global $config variable, for example by using settings.php file (the same method as for D7). But is it possible to ...
0
votes
1answer
19 views

How is comment widget controlled

In the core within the comment module a widget is provided by CommentWidget.php file (namespaceDrupal\comment\Plugin\Field\FieldWidget;). In this widget comment settings like open, close, hidden is ...
0
votes
0answers
17 views

How to duplicate a config entity via EForm

I am working with the EForm module and I have created an entity form using the UI, let's call it test_form. Now what I want to do is be able to duplicate this test_form into test_form_duplicate and ...
0
votes
1answer
46 views

Adding custom block problems

I've created my own module in drupal 8. I also created block in my module. I tryied to add my custom block (which is type of custom form) to view. But when I am trying to add custom block in view, its ...
0
votes
1answer
21 views

Render a custom menu in a custom block

I want to create a block that contains somes links of a menu, without using the interface. So I created a custom module. Inside, there are somes files. a mymodule/test.links.menu.yml : ...
0
votes
1answer
21 views

PHPUnit with custom/contrib and submodules structure

I am starting to write our tests with PHPUnit on Drupal 8, and I am not sure about the best practices with the phpunit.xml.dist file. We separates the custom and the contrib modules using two ...
0
votes
1answer
12 views

Ajax form in block

From my experience, I believe Drupal8 treat Form API in BlockBase differently from FormBase Class, the below block doesn't seem to work. Do I have to do anything else to make Ajax Form work in Block? ...
1
vote
1answer
21 views

Extending Entityreference Field Class to contain additional input fields

I am currently trying to build a custom field consisting of an EntityReference Input Field (Autocomplete Widget) and two textfields to add additional information in Drupal 8beta11. I used the code ...
0
votes
1answer
15 views

hook_entity_bundle_field_info_alter() only validates article bundle

I used hook_entity_bundle_field_info_alter to validate fields in node as below: function my_module_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, ...
0
votes
1answer
21 views

why doesnt Drupal recognize my route name?

I have a module I am upgrading from 7 to 8. I am working on the mymodule.routing.yml file mymodule.admin: path: '/admin/structure/mymodule' route_name:mymodule defaults: _controller: ...
1
vote
1answer
32 views

Clear cache of node

I am implementing hook_entity_view() in my module. In the hook I am adding a link to the node by rendering a array. The links need to be added only when a certain configuration condition becomes TRUE. ...
0
votes
1answer
35 views

Twig C extension in drupal 8

In Drupal 8, Admin-Report > Status report > Twig C extension: Not available Enabling the Twig C extension can greatly increase rendering performance. See the installation instructions for more ...
0
votes
1answer
27 views

Fetch field values in drupal 8

How to query all the values of a particular field. I used Drupal\Core\Database\Connection object to fetch the values as below: $connection = \Drupal::database(); $result = ...
0
votes
1answer
27 views

Why am I getting a PDO Exception error when I try to run Drupal Console inside the root directory?

I've installed Drupal Console and can confirm it is in the proper directory, etc. I run the command "Drupal" from my home directory and I see a Drupal Console help list of commands, but when I run it ...
-1
votes
1answer
37 views

Custom layouts with the Display Suite module

How can I make a custom layout with the Display Suite module in Drupal 8? I checked the example for Drupal 8, but didn't work for me. Could anyone help me?
0
votes
0answers
22 views

Providing translations for custom modules

I'ld like to provide module specific translations for my custom modules. I followed the instructions in ...
0
votes
1answer
17 views

How do I override/theme Views REST Export display field?

I have a REST Export view display setup in Drupal 8, delivering node fields. The challenge: I want to theme/tweak/alter the output of JSON or HAL_JSON for and image field. Currently, it's rendering ...
0
votes
1answer
25 views

Making title unique using hook_entity_bundle_field_info_alter() - Drupal 8

hook_node_validate is replaced by hook_entity_bundle_field_info_alter in Drupal 8. I need to validate the node title whether the same title is used in any other node. Title field should be unique for ...
2
votes
1answer
27 views

How to create a default value for an entity base field in Drupal 8

Both the Examples module and the Drupal Console generate:entity:content both have code like this: $fields['first_name'] = BaseFieldDefinition::create('string') ->setLabel(t('First Name')) ...
0
votes
0answers
28 views

Should the Drupal 8 sites/default/files/config folder be stored in git with its hash suffix?

New question title: "Should the sites/default/files/config folder be stored in git with it's hash suffix?" " Reason I ask this is that this might cause 2 issues: May be a hindrance when comparing ...
1
vote
2answers
45 views

If you update a routes file in Drupal 8 how do you clear the cache?

Having worked with Drupal 7 since its launch, I'm learning Drupal 8. At the moment I'm finding that whenever I change anything I have to do drush cache-rebuild to get things working again. On my VPS ...
1
vote
1answer
38 views

Drupal 8 - Taxonomy Menu with Hierarchy

I have been looking searching for a while and couldn't find anything related to Drupal 8. There are Modules like Taxonomy Menu but unfortunately not for Drupal 8 which works accordingly. Is there ...
3
votes
1answer
66 views

Creating field on each node

I want to add a field on each node which links to a particular page where module's controller will act. I want to actually add a link at bottom of node, and I want to do this programmatically. But I ...
0
votes
1answer
42 views

Programatically render a view in twig template

I want to render a particular view like Who's new,Recent content present in the core in my the twig template.Any suggestion on how to do it? I was thinking of using views_embed_view() because in ...
0
votes
2answers
34 views

Using Configuration API in drupal 8

I altered node_type_edit_form and added a section to get some settings like below: Now I need to save the configurations and build the default value based on last selection using Configuration API ...
0
votes
0answers
34 views

In Drupal 8 Javascript is not enabled by default on all pages? How can I enable it for specific pages?

How can I enable the javascript or jQuery in certain pages in Drupal 8? Any example will be really helpful. Thank you.
1
vote
0answers
24 views

Parameters in the HTTP request

I am trying to render a block depending on the parameter(entity) present in the requested page. Suppose if I am on a url like this: http://localhost/drupal8/user/1 then a block with label user is ...
0
votes
0answers
23 views

How to change DB active config storage of an installed site to config file storage?

The default.settings.php says /** * Active configuration settings. * * By default, the active configuration is stored in the database in the * {config} table. To use a different storage ...
0
votes
0answers
48 views

HTML output of whole page

I am trying to generate html output of whole page and then pass it to response array.I am doing something like this: $page = array( '#theme' => 'html', '#page_object' => new ...