Questions tagged [8]

Version tags should be used for questions that apply to a version only, not to merely say what version a site is using.

Filter by
Sorted by
Tagged with
6
votes
3answers
3k 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 ...
64
votes
8answers
111k views

How do I get the current path alias or path?

How can I get the current alias and/or path in Drupal 8? In Drupal 7 I did this with drupal_get_path_alias(). What is the equivalent code I should use in Drupal 8?
1
vote
1answer
855 views

Integrate external DB users via their API in Drupal 7

I want to integrate an external API (REST) to login users which are on that external database using the drupal 7 login form on my site. I have the API specifications for Login, Registering, Getting ...
13
votes
3answers
9k views

Will migrating content types be possible?

I have a Drupal 7 site with 40 content types. When Drupal 8 will be released than I would like to migrate these content types. Would this be possible, or would I have to create this content types ...
5
votes
3answers
6k views

Clean URL not working

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
775 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 value(...
3
votes
1answer
1k 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
53 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
147 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
817 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 run ...
2
votes
2answers
1k views

How to attach/upload a file to node using restws?

I've got a content type with "File" field and "File" widget. I am successfully able to create a node without a file using restws. But, if I want to attach a file to it, it just doesn't allow me to do ...
9
votes
3answers
11k views

How do I add CSS & JavaScript to <head>?

I want to add the following code in my section of the front page using a Drupal 8 sub theme of Bartik. Can anybody help how to do it? What is the best way to do it in this new twig version of theme?...
0
votes
1answer
230 views

Hyphenated nodeName or DTD nested in XML causes Feeds XPath Parser failure

I am using Feeds and Feeds XPath Parser. I have an XML source like this. <xml> <records> <record> <EAC-CPF xmlns:eac="http://jefferson.village.virginia.edu/eac" ...
5
votes
3answers
11k views

Login with a REST service (services module)

I work with Drupal 7 (services 3.x) to implement a REST service. When I test a login request with this script: $service_url = 'https://dev.mysite.org/api/blog/user/login.xml'; // .xml asks for xml ...
2
votes
1answer
978 views

Portable content types

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 ...
1
vote
1answer
20k views

Attach file to post using C# RestSharp and Drupal Services [closed]

I'm writing a C# app that posts to Drupal using Rest calls to the Services module, I can connect and create new nodes easily but I cannot figure out how to attach files to the nodes. Using the ...
0
votes
1answer
565 views

Drupal Rest Service - Create node problem [duplicate]

I'm using POSTER add-on (Firefox) to create a node.(REST service). I couldn't able to create node having select/checkbox item. Getting following error in response. ["An illegal choice has been ...
2
votes
4answers
3k views

Adding (external) javascript to a 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 MYTHEME_preprocess_page(&$...
5
votes
1answer
196 views

Why use constuctor injection in controllers or forms?

Documentation is proposed to use injection in constructor instead of using \Drupal::service(). Why? Example with injection: class MyController extends ControllerBase implements ...
3
votes
2answers
387 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 \Drupal:...
1
vote
1answer
306 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 ...
2
votes
1answer
489 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: entity/view/...
5
votes
1answer
768 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
119 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
votes
1answer
60 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 ...
2
votes
1answer
550 views

Why didn't we got rid of primary entity keys in favour of UUIDs?

I just remembered, while working with custom entities, that Drupal 8 was supposed to bring UUID support and replace the old "entity id" keys but then I've also noticed that the old fashioned entity id ...
5
votes
1answer
2k views

Why does Drupal 8 default .gitignore suggest ignoring config directory?

In Drupal 8, perhaps the most anticipated feature is separation of configuration from content; ie- configuration is longer stored in the database. It achieves this now by storing configuration ...
0
votes
2answers
2k views

How to properly recognize a session id generated by drupal?

I'm storing stuff in a session that is sometimes handled by drupal. The session id is passed forward to another service, which checks back to the original server to get the session data. When the ...
1
vote
1answer
73 views

How are Field API fields transfered from config entities to content entities?

So I am creating a content and config entities - exactly like node and node type. After I've created them I've noticed that I can add fields to the config entities, which is ok but then I've realised ...
-1
votes
1answer
134 views

How are the 4 tables for revisionable and translatable entities in Drupal 8 meant to be used?

There are 4 tables for each type of entity, entity entity_revision entity_field_data entity_field_revision How exactly are the individual tables meant to be used?
8
votes
3answers
6k views

Devel dsm() function in Drupal 8 page.html.twig

Is Devel module's dsm() function available in page.html.twig? If it is not available, is there a way to make it available? I am able to use dsm() in .theme file but not in page.html.twig. I am ...
8
votes
1answer
4k views

Working with template suggestions on Drupal 8

I need Drupal to use a custom page template if the URL contains a particular _GET parameter. In D7 I would do something like this in the theme's template.php: function mytheme_preprocess_page(&$...
7
votes
2answers
8k views

Printing field item attributes with Twig / Drupal 8

In Drupal 7, I can do this in a custom field template to print the alt tag of an image: <?php print $item['#item']['alt']; ?> And though "item" seems to be a variable in Twig / drupal 8 fields,...
2
votes
1answer
2k views

How to perform a REST request after a node created using rules?

I have a backend service written by Python, which is exposed a JSON api. And I want drupal to perform an HTTP POST/PUT/PATCH/DELETE... request with json data (which is an output of a node) to the ...
3
votes
2answers
2k views

Using drush on drupal 8?

Dursh works very well with my Drupal 7, but when I try running Drush on Drupal-8 directory it throws some error message, $drush pm-list Command pm-list needs a higher bootstrap level to run - you ...
3
votes
1answer
558 views

Issues with namespaces and Migrate module migrating XML content

In the Migrate module I noticed that one reason I could not import an XML file was because it contained namespaces. Removing namespaces from the XML file and Migrate class allowed me to import the ...
15
votes
4answers
21k views

How do you implement a custom submit handler in hook_form_alter()?

I've been updating one of my Drupal 7 modules to 8 and I'm having an issue with my form alter. I'm adding a validation function and a submit handler. The validation function is getting called just ...
3
votes
1answer
791 views

Create Node contains Field collection with restws + services

I am trying to create a node with RESTFULL api using restws and services modules (latest versions) on Druapl 7 - openpublish destro. the node contains a Field collection (images field collection field)...
0
votes
1answer
1k views

How to display JSON returned (from external REST API) in a Block? [my code attempt inside]

I am trying to display the data from a REST API (URL: 'http://api.kivaws.org/v1/loans/38239/lenders.json') to display in a block. Below is my code. It is not working, any hint on why will be sincerely ...
8
votes
5answers
10k views

Adding JS to a Drupal 8 theme (replacement for drupal_add_js)

In Drupal 7, I can use drupal_add_js within a theme's template.php file as a theme_preprocess_html(&$vars) function: drupal_add_js(drupal_get_path('theme', 'mytheme') . '/js/scripts.js', ...
5
votes
3answers
10k views

Trying to render a custom date format with Twig

I'm in the process of porting one of my contrib themes to Drupal 8. For custom date formats on nodes, I have something like this in a node_preprocess function in the theme's template.php file in the ...
1
vote
1answer
258 views

Is updating the composer.json file & consequently composer.lock in Drupal 8 considered a good practice or hacking the core?

I have been working with another developers on a scaffolding tool for Drupal8 based on Symfony Console component. The current setup process includes updating composer.json using composer CLI: ...
5
votes
3answers
3k views

RedirectResponse not working

I'm in the process of porting my modules from D7 to D8. No real problems so far, but... I have a multistep form from where I need to redirect to /node/add/xyz in the last step. (All required input ...
10
votes
1answer
8k views

How to create custom entity in Drupal 8 [closed]

I have a big personal project build on Drupal 7 that has many custom entities. I want to start upgrading the project into Drupal 8 but the completly rewritten Drupal 8 core is too big for me to get my ...
2
votes
3answers
365 views

Is registering a controller as a service still frowned upon in D8

In the presentation given in Portland by Kat Bailey in May, registering a controller class as a service was highly discouraged, however a lot has changed since then and I wanted to check if this is ...
5
votes
1answer
2k views

How do I construct a thin controller with a dependent service?

For the first time I am trying to architect a reasonably complex Drupal 8 module, and not sure of best practice for the controller. I need to route paths to a controller. I intend the controller to ...
10
votes
3answers
8k views

Multistep/wizard forms

I'm trying to create a multistep/wizard form for Drupal 8. User fills in a first name, last name fields Clicks on the next button Fills out more information Clicks on the submit button There are ...
4
votes
1answer
4k views

Non-CRUD resource action with Drupal 7 / Services 3

I can't get this simple example working with a custom action. I had to move it form here How can I create a simple non-CRUD resource action with Drupal 7 / Services 3? to an own question. The ...
4
votes
1answer
2k views

Define JavaScript library in Drupal 8

In Drupal 8 some javascript changes were introduced so now all js scripts should be defined using hook_library_info() and added to the page only with #attached attribute of the render array. But what ...
4
votes
1answer
14k views

Trying to install Drupal modules and themes: keep getting error “does not contain any .info.yml files.”

I am new to Drupal. I am running Drupal 8. I have tried to install three different themes and modules, and keep getting this error: does not contain any .info.yml files Including with the Beale ...