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

learn more… | top users | synonyms

1
vote
0answers
28 views

How do I add custom validation constraints to Entity fields? [duplicate]

I'm trying to add validation (i.e. constraints) to a field added to a specific (node) entity. As per documentation here https://drupal.org/node/2015613 i'm trying to change the Field Definition to ...
1
vote
0answers
16 views

How to display a field of an entity in drupal 8? [on hold]

I've studied D8 for one and a half month, D8 is so difficult for a complete newbie, almost all articles about D8 are for people who have experence on D7,on the contrary,it brings more confusion , not ...
0
votes
0answers
19 views

How to get all filters and functions available in Twig templates?

I have an option to create and edit twig templates via UI but I need to display what filters and functions are available to the user but I don't know how to get them.
0
votes
1answer
42 views

Drupal 8 Twig Debug - not seeing all template suggestions for views

I'm trying to get all the template suggestions for my view and back in the day, there was a simple theme:suggestion link you could click on in Views UI to get all the dozens of template suggestions ...
6
votes
1answer
278 views

What is the convention for naming routes?

Lets say I have these paths: /admin /admin/settings /admin/settings/myentities myentity/id /admin/settings/myentities/id/edit /admin/settings/myentities/id/delete What would be the proper route ...
1
vote
0answers
18 views

How should the code structure of a distribution look like?

I'm making a distribution and so far it consists of only one module which holds the whole code. Since D8 is now fully OOP and has autoloader and other stuff I was wondering how should the structure ...
0
votes
1answer
53 views

Drupal 8 Menu Tree issue in my contrib theme possibly because of “Convert menu tree building to a service.”

Previously, in my Drupal 8 contrib theme, I was rendering the full menu tree as: function gratis_preprocess_page(&$vars, $hook) { // Build the main menu links tree. $vars['primary_nav'] = ...
3
votes
2answers
93 views

What is the correct way to document the schema for a YAML file?

As a module developer, I'd like to convert some of my Drupal 7 info hooks to YAML discoveries in Drupal 8, but it's not clear to me how to document the schema of a YAML file for consumers. For a hook, ...
0
votes
0answers
58 views
+50

How to use ajax in Views Row plugin options form?

I am trying to replace entity view modes with Views, so far successfully. I've created a Views Field called 'div' that allow me to wrap other fields in a DIV html element to which I can assign HTML ...
0
votes
0answers
17 views

Is using configuration entities for standalone and derivative plugins a good practice?

I have plugin type called ShippingMethod. Then(for example) I have three implementations of this plugin: Generic, DHL and Myself. The Generic plugin can be created by user multiple times = ...
0
votes
0answers
22 views

How to get list of templates for the active theme?

I am creating UI that will allow users to edit the active theme's template files(something like Wordpress does). For this I need to get the list of all templates from the system and to know which ...
0
votes
1answer
20 views

How to use GROUP BY and SUM in Views table?

I have custom entity "product". It's base table is "product" and it's primary/id key is "entity_id". I have created all Views definitions for this entity. Additionally I have another table called ...
3
votes
1answer
95 views

Drupal 8 get the updated content of a block via an Ajax call

I am trying to get to grips with Drupal 8s layout and and architecture. Having worked with Drupal 6 for the last 2 years I have become used to its procedural style, so I am finding the OOP approach ...
5
votes
1answer
78 views

What is plugin bag?

I fail to see the difference between plugin bag and plugin manager. As I look at it both just instantiate plugins with optional configuration.
0
votes
1answer
48 views

Missing config file and cannot install Drupal 8 Development version [closed]

I am trying to install Drupal 8 on IIS 7. When I run Drupal for the first time, I get an error. PHP Fatal error: Call to a member function get() on a non-object in ...
0
votes
1answer
21 views

Is it possible to select all results in Views bulk actions form?

By all results I mean even those that are not displayed on the current page(if there is paging).
1
vote
1answer
58 views

What is the difference between $container->get('current_user') and global $user?

I've been looking at symfony's implementation of dependency injection, and it seems like a service locator pattern. It appears, at first blush, that the service container is not entirely different ...
6
votes
2answers
367 views

With Drupal 8 should I learn Symfony 2 and Drupal for development?

I saw this, How much of Drupal 8 will rely on or be compatible with Symfony? But didn't understand how that applied to my question. What should I do for development in Drupal?
1
vote
1answer
28 views

Is it possible to set per-field access in Views in Drupal 8?

I guess altering Views fields' render method and adding setting into field's options would be a good solution but how would I be able to do this?
3
votes
2answers
103 views

How do I make a Drupal 8 theme require Jquery (for anonymous users)?

I'm creating a theme for D8 called 'herchel'.I'm trying to get this theme to require jquery on all pages (D8 doesn't load Jquery for anonymous users by default) Looking through the what little ...
3
votes
2answers
61 views

Is Migrate module supposed to be used for imports too?

I am in need of an entity import functionality so I started to write my own. But then I started to think if I'm not reinventing the wheel and it occurred to me that maybe Migrate module will be used ...
4
votes
1answer
86 views

Programmatically create term in Drupal 8?

I'm attempting to add a lot of terms (~200) to a vocabulary, but I can't find any import modules that are updated for Drupal 8, and it seems the functions for doing this in Drupal 7 don't exist in ...
1
vote
2answers
45 views

Auto fill title

I'm trying to auto-fill the title a content creation form in Drupal 8 with the user ID of the person creating the node, but I can't seem to get past step 1, which is having the title default to ...
2
votes
2answers
393 views

Why do lots of D8 functions require more code than the D7 equivalent?

Every time I read about how to convert code from D7 to D8 is seems like the D8 version is longer. For example drupal_goto was: drupal_goto('user'); and the D8 equivalent is: return new ...
0
votes
1answer
26 views

“Class not found” error when attempting to access inbuilt DateTime class [closed]

I am attempting to convert a working Drupal 6 module to Drupal 8 in preparation for the up coming release, and as an exercise in learning the new system. In my existing module, I do some calculations ...
-1
votes
2answers
52 views

Drupal 8 Add Javascript [duplicate]

What is the best way to add javascript to Drupal theme now that drupal_add_js is gone? I want to use specifically jQuery ui animate, which I suspect is in Core, but I cant find out how to add it to ...
1
vote
1answer
36 views

How to properly call entity form?

I have created a wrapper in form of a "page" controller for my entity's form because I needed to do some tasks before it was rendered. I ended up with this: <?php class MyEntityController ...
5
votes
2answers
142 views

How to perform entity validation on code level?

I have an entity that has a field attached to it and the values that user types into the field has to be globally(website) unique(compared to other entities). I have added validation to the entity ...
0
votes
2answers
47 views

What DataType should I use for serialized entity fields?

In many entities I have I am using a field that is for various metadata and it's stored as serialized array in blob form. When defining the field in entity's baseFieldDefnitions I've used the 'map' ...
1
vote
0answers
50 views

What's the proper way to load theme's libraries?

So I have created my first Drupal 8 theme which uses Foundation and a glyph font. According to the best practice I've made these as theme's libraries. Of course I need to load them in my theme. Now ...
2
votes
3answers
82 views

Drupal 8 devel dpm does not expand Drupal\node\Entity\Node

I'm getting a feeling that Devel got pretty much useless with D8. When I try to dump most of the drupal objects I get only (Object) Namespace\Class output. No fields data is printed. print_r is able ...
2
votes
2answers
86 views

get current url path in drupal 8

How can I get current url with alias name of it ? I am now in drupal 7 I did it with drupal_get_path_alias() ,How can get current url alias(if alias set else url) of current url in Drupal 8?
7
votes
3answers
404 views

Migrate from drupal 7 to drupal 8

I have a Drupal 7 site with 40 content types. When Drupal 8 will be released, I would like to migrate these content types. Would this be possible, or would I have to create this content types from ...
0
votes
2answers
84 views

Clean URL not working for Drupal 8.x-dev

I have downloaded Drupal 8.x-dev at https://drupal.org/node/572834 to test on my local PC (Xubuntu 14.04 Beta 1). I have successfully installed but when I try to access Admin menu is giving me "Not ...
0
votes
1answer
40 views

How to filter entities in View by all of their taxonomy term reference fields?

Let's say I have a custom entity that has two taxonomy reference fields: categories and tags. And I want to display all entities that have taxonomy term with id 1. The term is a dynamic ...
0
votes
1answer
54 views

What are the major differences in building an install profile for Drupal 8? [closed]

There is a good guide for drupal 7 which explains how to build a install profile for drupal 7. I built an install profile using it. But I want to build an install profile using Drupal 8. What changes ...
0
votes
1answer
39 views

Is it possible to write node migrations for D8 alpha/nightly yet?

If the migrate api in core is currently capable of doing simple d8-to-d8 migrations, where could I find documentation on how to do so? This is more or less a learning exercise and I am only trying to ...
1
vote
1answer
53 views

Multiple nodes in a single Views row

I have a content type Cars and a content type WheelManufacturer. Of course a WheelManufactorer node is referenced by a Car node. I'm trying to create a View (in D8) that will fetch some fields from ...
0
votes
2answers
76 views

js doesn't work for anonymous in D8

for admin work good! for test i just write this: jQuery(document).ready(function(){ alert(1) }); Thanks for any help -) UPDATE: my JS file attached to tag but code not run, any js code not ...
2
votes
2answers
107 views

How to add css, scripts in <head> section of Drupal 8

I want to add following codes in my section of the front page - Drupal 8 , sub bartik theme. Can anybody help how to do it? What is the best way to do it in this new twig version of theme where there ...
2
votes
1answer
67 views

Portable content types with Drupal 8 and CMI

I'm used to leverage Bundle Copy to import/export content types with Drupal 7. One of my expectations with Drupal 8 is that I could theoretically achieve this with CMI. On the Bundle Copy project page ...
0
votes
1answer
43 views

What is the best approach to create a plugin that acts as form? [closed]

I want to transform a checkout form into plugins so that I can choose how will my checkout form/process look like. I also need the checkout plugin to alter the main checkout settings form and attach ...
0
votes
1answer
84 views

Adding (external) javascript to a Drupal 8 theme

I'm trying to add external javascript to my Drupal 8 theme. Can someone tell me what I'm doing wrong here? This function is in my MYTHEME.theme file: function ...
2
votes
1answer
97 views

Why use constuctor injection in controllers or forms?

Documentation is proposed to use injection in constuctor instead use \Drupal::service(). Why? Example with injection: class MyController extends ControllerBase implements ContainerInjectionInterface ...
5
votes
2answers
123 views

Why do so many classes define a ::t() method?

I've encountered MANY methods substituting the translation function — forms, entities, plugins... What is the point when there is the global t() function that has exactly the same code return ...
1
vote
0answers
71 views

How to keep your Drupal 8 site synced with 8.x branch

Is it practical to both A) develop/maintain a Drupal 8 alpha site and B) keep it up to date with the latest daily/hourly commits from the 8.x branch ? If so, what would be your strategy to keep your ...
1
vote
1answer
50 views

How to GET REST resources for Views

Getting a node via Drupal 8's RESTful web service can be done by doing a GET with this url: /entity/node/1 How then, do you access a View? I've tried the following, with no luck: ...
5
votes
1answer
95 views

Why are values in Entites obtained directly and sometimes by using getters?

For example Drupal\Core\Entity\Entity::id() returns $this->id(or NULL), Drupal\Core\Entity\ContentEntityBase::id() returns $this->id->value, Drupal\Core\Entity\ContentEntityBase::uuid() returns ...
2
votes
1answer
91 views

How to work with TypedData?

So I was wondering how to utilize this new addition to Drupal. For example, should I use TypedData to set default value, description or required attributes in (entity)forms? What is the usage of ...
1
vote
1answer
31 views

Which entity table should be used for data common to all revisions?

Translatable and revisionable entity has ho have four tables in Drupal 8: entity, entity_revision, entity_field_data and entity_field_revision. Let's say I have a "product" entity and the product has ...