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

learn more… | top users | synonyms

0
votes
0answers
30 views

Creating a custom FieldType (D8)

I'm trying to create a custom FieldType which provides the fields for a complete address (street, house_number, post_code and city). I created a FieldWidget, FieldFormatter and FieldType class and a ...
0
votes
1answer
16 views

Autoloading in Drupal 8 or How do I load an external class into the Controller? [duplicate]

I'm playing with module building in Drupal 8, but can't really figure out how to include a custom class which does not extend any other. The class' only purpose is to reduce the amount of code I have ...
1
vote
1answer
61 views

How to include custom class file in Drupal 8 module

In Drupal 7 module development, I could include a custom inc, api, or php class file using the file[]= directive in the module.info file or the drupal_load_included() function. With D8 using PSR, ...
0
votes
1answer
29 views

Is it possible to disable a node module?

Is it possible to disable a node module in Drupal 7? As I understand through interface it is not possible. Why node module is so important? What if I'm going to use only custom entities?
2
votes
1answer
34 views

Doctrine annotations for custom field formatters in Drupal 8

I am trying to port my Drupal 7 module, Views Hybrid, to Drupal 8. It provides a custom field formatter. In order to provide the field formatter, I am using the Doctrine annotation roughly following ...
0
votes
2answers
48 views

Consuming RESTful web services with Drupal 8

Is there any existing Drupal 8 module (on drupal.org, GitHub or anywhere else) that would leverage Guzzle to consume JSON and/or HAL+JSON Web Services over REST? Alternatively, is the recommended way ...
0
votes
2answers
28 views

Getting image SRC with xpath - Simpletest (WebTestBase) [closed]

I am developing a Drupal 8 test which will check for a image's existence. The image will not be loaded while running the test and I want to catch that using xpath(). The HTML I am trying to search ...
0
votes
2answers
39 views

Attach js file to every page w/term reference widget in Drupal 8

I have begun trying to port a small, simple module that I maintain to Drupal 8. It was originally written (not by me) in Drupal 6 and used hook_init() in combination with drupal_add_js() to attach ...
3
votes
3answers
103 views

how to load a third party php library for drupal 8

I have a third party php library which I would like to use in a module. How do I do that in Drupal 8? In drupal 7, I have done things like: require(libraries_get_path('twitter-api-php') . ...
1
vote
1answer
41 views

Drupal 8 Configuration API - cant access variables

I have made a simple example to practice using the configuration api in drupal 8. I created the following twitter_pull.credentials.yml file in the config/install folder: oauth_access_token: "12345" ...
0
votes
0answers
36 views

How do you set up Xdebug on IntelliJ for Drupal modules

I've been trying to set up Xdebug for my drupal site in IntelliJ (though I imagine it is the same in PHPStorm). I've tried the 'remote debug' and the 'PHP Web Application' options in the Run/Debug ...
0
votes
1answer
50 views

Drupal 8?! Why does Drupal download webpage recommend Drupal Core ver. 7.x? [closed]

Why does Drupal download webpage recommend Drupal Core ver. 7.x? I can hardly see footprint from Drupal version 8 in Drupal website direct links. Does it mean that Drupal 8 is still under ...
4
votes
1answer
139 views

How do the seasoned OO PHP people go about setting up a professional development environment and how can we apply this to Drupal 8

A few years ago I was in to Drupal 7 development. Back then, in the company I worked for, we just kept everything in the database, had a few modules we kept on disk somewhere, didn't really use ...
3
votes
1answer
145 views

Drupal 8 - “Implement menu links as plugins”, trying to build a menu tree

In a previous Drupal 8 menu question here, we determined that menu tree building was now a service. In my D8 contrib theme, I was then able to render the main menu tree as: function ...
0
votes
1answer
24 views

Default installation of D8 treatment of .gif accesses?

If I request a non-existent URL, say, /ddddd I get Page not found (as expected). If I do th4 same with an unusual extension /dddd.xcf I also get Page not found. BUT if I request /ddddd.gif there's an ...
1
vote
1answer
56 views

Correct way to use hook_menu_alter

What is the correct way of using hook_menu_later. I did this in my module to redirect (see also redirect in hook_init makes body text disappear): function MYMODULE_menu_alter(&$items) { ...
2
votes
1answer
40 views

Check for double escaped string - Simpletest

I am trying to create a test case against a patch which will be used for automated testing in D8 release. However, I am trying to do it to check if the page I am on it, has any multiple escaped HTML ...
0
votes
1answer
26 views

How to determine taxonomy vocabularies related to a specific content type in Drupal 8?

could anyone help me please, how to get the vocabularies to a given content type? For example in older Drupal cores there was a taxonomy_get_vocabuleries($type) ...
0
votes
2answers
134 views

Drush was not able to start (bootstrap) the Drupal database - MySQL Access denied error

I've installed Drush 7 using Composer and working with Drupal 8 and 7 on Ubuntu 12.04 with PHP 5.4.31, mysql 5.5.38 Drush will dl modules and themes just fine but when I want to en a module then it ...
5
votes
1answer
105 views

Understanding Drupal 8 and namespaces

I am new to namespaces and I am practicing with Drupal 8. I have created a custom module and have installed the contrib, devel. Inside my module, I have defined a block, here is my code: namespace ...
0
votes
1answer
22 views

Drupal 8 module - page errors out

I have a drupal 8 sandbox site where I have started a module. I am practicing with registering paths. on my /tweets page, it errors out and says "Drupal has encountered an error". What is wrong with ...
0
votes
2answers
74 views

How to receive JSON data in controller with Drupal 8?

I'm using AngularJS one of my module's settings page, so I have a javascript object in client side as a model. Could anyone help me please, how to catch this data in a controller if I send it as JSON ...
1
vote
1answer
38 views

Drupal 8 condition plugin, two on the same form?

I'm working on porting the CAS module to Drupal 8. On the main configuration form, users can list paths that will activate a feature of the module. I read about using the new condition API recently, ...
2
votes
2answers
129 views

How to pass an extra argument to an entity form?

Suppose, I've two entities: entityA entityB A user creates an entityA and has the option of creating multiple types of entityB referenced from a single entityA. For example, a parent-child ...
0
votes
1answer
31 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
35 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
39 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
38 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
31 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
1answer
77 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
69 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
78 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
26 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
43 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
68 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
52 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
36 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
1answer
37 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
26 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
32 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
124 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
52 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
104 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
43 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
45 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
144 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
42 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
66 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
2answers
358 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 ...