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

learn more… | top users | synonyms

0
votes
1answer
19 views

How can I list all Twig functions and filters with their description?

I want a list of all available Twig filters and functions and for each one of them I need to have a description of the function/filter so the user can see what functions and filters are available and ...
0
votes
1answer
15 views

Making entities under another entitytype

Suppose, I've created -name -machine_name an entity_type myentity with its schema as: -name -machine_name Next, I want to create another entity subentity that will be grouped under myentity. ...
0
votes
1answer
29 views

Output taxonomy term in views unformatted using twig

I'd like to output taxonomy terms as html classes for view-rows in the views unformatted template for Drupal 8. My code: {% if title %} <h3>{{ title }}</h3> {% endif %} ...
1
vote
1answer
32 views

How to define an optional argument to Route callback

I want define a simple controller action, which receive optional argument: <?php namespace Drupal\hello\Controller; class SimpleCallback extends ControllerBase { public function ...
1
vote
0answers
22 views

Twig templates are not loading

I am using Drupal 8 from github:drupal/drupal@a9ac0fbf17, but having problems creating custom template, using Twig template engine. Here is template file structure: . ├── README.txt ├── ...
1
vote
0answers
32 views

How do I add classes to main menu ul and li in Drupal 8

I want to generate the html elements and their classes to fit my styling of the main menu. I'm confused by all the near-possibilities offered in the api documentation and by looking at core themes ...
1
vote
1answer
59 views

Passing object in routing.yml

I have an entity and when I try to pass the whole entity object, only the name is passed through the routing. Here is the relevant code in routing.yml: mymodule.myentity_info: path: ...
1
vote
1answer
58 views

Drupal 8 JavaScript and Best Practice

I am building a theme for Drupal 8 that I want to make available in the drupal.org theme section. As such, I want it to conform to best practice code wise. When adding JavaScript, I notice there has ...
0
votes
1answer
24 views

EntityListBuilder only shows the last Entity that was added

I've build up an Entity for my module. The problem is that the EntityListBuilder doesn't show all the entities that I've added. Only the last entity that I added shows up. Here is the drupal sandbox ...
0
votes
1answer
28 views

Checking if a machine_name exists or not

My EntityForm has a field where '#machine_name' => array( 'exists' => array($this, 'load'), To check the validation of this, I wanted to know about writing the function load() in my ...
0
votes
1answer
55 views

Building EntityForm in Drupal 8

I'm continuously getting the error: Drupal\Core\Config\Schema\SchemaIncompleteException: Incomplete or missing schema for mymodule.myentity.myentityname in ...
0
votes
1answer
30 views

Add placeholder to fom in twig template override

I enabled twig debug and realized need to add block--search.html.twig to my theme. Then I used dump(content) to see if I can add a placeholder to search input field {% extends ...
0
votes
0answers
30 views

How do you edit the contextual links on a custom block in drupal 8?

Currently the only link that shows on the contextual links for custom blocks is the "configure block" link. I want to add an edit link to get to the main content of the block, is this possible?
0
votes
0answers
27 views

drupal_html_id() alternative for non-Ajax content?

I am looking for a drupal_html_id() function alternative which returns incremented ID's of non-Ajax contents only. Is this "ajax/non-ajax" distinction feasible in this context or any other way? If ...
0
votes
1answer
22 views

How to avoid caching of fields in Entity View?

I have a few computed fields on my entity and they have dynamic values. These values cannot be cached because they change often. I've created the necessary field formatter that uses the same approach ...
1
vote
1answer
30 views

How to configure a view accessible on user's profile only by that user

I have a View listing content the user have authored. The view is located on /user/{user}/mycontent path. How should I configure the View so other users won't have access to this page and/or see their ...
1
vote
1answer
100 views

How to send files to Drupal 8 via REST

I can create articles via REST without problems. But I can not figure out how to submit files. How do I submit files (images) to Drupal 8 via REST? Update: Rest UI - File: /file/{id} Example ...
0
votes
2answers
47 views

Modifying routing based on Drupal 8

As in Drupal 7, I had this in mymodule_menu() (Implementing hook_menu()): $items['admin/config/mymodule/page1'] = array( 'title' => 'Mymodule Page1', 'page callback' => ...
1
vote
2answers
97 views

Theme a node form in D8?

I'm attempting to theme a node add form for my new slide show content type in D8 using an example for D7 that I found here, but I'm not having much luck. I've made and enabled a module named ...
0
votes
1answer
37 views

Get the default value of a variable

I want to display the default value of a variable when no value is set. I checked the Drupal 8 documentation pages, but I couldn't find any information about the default value. In Drupal 7 if ...
1
vote
1answer
33 views

Preferred way of loading a specific entity revision

In drupal 7 you can do this to load an entity revision using entity_load($entity_type, $ids = FALSE, $conditions = array(), $reset = FALSE) like this: $old_revision = entity_load('node', array(), ...
2
votes
2answers
117 views

Do Drupal 8 / backbone.js have conflict when using AngularJS on top?

I've just pulled D8 HEAD for my website and I want to use AngularJS instead of backbone.js to create a web app but realized D8 have already embedded backbone.js on every page. I can disable modules ...
1
vote
0answers
33 views

Is it possible to pass Drupal config values as arguments to services?

I'm writing a module that makes calls to a Web service to read and store data. Here's my services.yml file: services: example.connection: class: Drupal\Core\Http\Client I've already got a ...
0
votes
1answer
41 views

How to load entity by UUID from url argument?

Usually routes have the {entity_type} argument in their path and Drupal loads the entity by the ID that is the url argument. For example route defining /node/{node} would work with /node/5. I need to ...
0
votes
1answer
26 views

How can I use View modes for entity without bundles?

I have an entity that has no bundles(ie. it has itself as a - 1 - bundle) and I need to be able to use View modes for it. My understnading is that the Field UI needs the 'bundle of' entity to exist ...
0
votes
1answer
199 views

Drush was not able to start (bootstrap) the Drupal

Installed drush 7 using Composer & working with Drupal 8 with xampp stack on Windows. H:\xampp\htdocs\d8_test is the Drupal root. Location of settings.php file is ...
4
votes
2answers
185 views

Rendering arbitrary field values without a parent entity in Drupal 8

I would like to expose to the user their choice of field formatters and the respective field formatter options. The selected formatter would then render an arbitrary array of items in the same format ...
0
votes
1answer
38 views

How to hide blocks from administrator?

I need to hide some blocks from priviledged user so he won't be able to attach them to regions via the Block layout. What is the proper way of doing this?
0
votes
2answers
37 views

How to build route for entity without loading it?

I'm making a tree view of vocabulary terms and I need to link each term to it's page(depends on which link template name is provided as argument to my function). I'm loading the terms with ...
1
vote
0answers
65 views

Drupal8 site status - “unsupported release” / “not supported” is this deliberate?

Is this a deliberate message as drupal8 is not yet the latest production release? The reason for raising this question is that it was unexpected in my opinion to see this. I would not have expected ...
1
vote
3answers
58 views

How to install Drupal without interaction via web UI?

Is it possible to confgirue installation profile so it can be installed via web UI as usual but without any interaction, just the progress bar?
2
votes
1answer
78 views

How can I get the page title in Drupal 8?

The drupal_get_title() function has been removed from Drupal 8. How I can get page title if using Drupal 8?
4
votes
2answers
188 views

Drupal 8 - Uninstall module

I am creating on Drupal 8 module. I have used custom table to store the data collected from forms. Somehow during installations tables are not created due to issue in install file. Now i have fixed ...
0
votes
2answers
197 views

How do I render a Twig template and load a CSS file from a controller?

Is this considered a good practice for rendering a Twig template and loading a CSS file from a controller? DefaultController.php namespace Drupal\acme\Controller; use ...
0
votes
1answer
46 views

drupal 8. How to override Drupal\Component\Datetime\DateTimePlus::createFromArray

i have to form datelist field. If user select incorrect date, for example 1970-02-31, displayed exception Exception: The array contains invalid values. in ...
0
votes
0answers
58 views

Group nodes in a View by Taxonomy (one by one) and allow duplicates in Drupal 8

I have 3 nodes with these tags : Node 1 - TAG 1, TAG 2 Node 2 - TAG 1 Node 3 - TAG 2, TAG 3 Here is what I want in my view (grouped by Tags) : TAG 1 Node 1 Node 2 TAG 2 Node 1 ...
1
vote
1answer
52 views

How to use Views on custom route?

Views require "Use AJAX" in order to display exposed filters when using Block display. I think this is necessary to avoid submitting/influencing other form elements on the current page. I have a page ...
1
vote
1answer
51 views

Drupal 8: CDN JS — cannot seem to weight it

I'm adding external JS in my Drupal 8 site (//cdn.leafletjs.com/leaflet-0.7.2/leaflet.js) and I cannot seem to weight it using hook_js_alter. I can weight it if I throw it in a themename.libraries.yml ...
1
vote
0answers
33 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
46 views

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

let's assume that I am writing a module named course,someone said if I wanna show the entity,I need to define an entity ,and a view builder,I do, I define a course entity and a CourseViewBuilder, I ...
0
votes
1answer
69 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.
6
votes
1answer
315 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 ...
2
votes
0answers
40 views

How should the code structure of a distribution look like? [closed]

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
94 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
113 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, ...
1
vote
0answers
131 views

How to use ajax in Views forms?

29.4 - I've been able to achieve my original goal though not with ajax. That proved quite impossible so I ended up with checkboxes for each action. I've updated the code below if someone is interested ...
0
votes
1answer
35 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
62 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
130 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
114 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.