Drupal 8 is the latest version of Drupal. 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
4 views

Custom translatable content entity appears twice when choosing the entity type to create a view

Developing a custom module with custom content entities that needs to be translatable. The problem is that when they are made translatable by adding: translatable = TRUE in the @ContentEntityType ...
0
votes
0answers
3 views

finding a route to form mode and add it local tasks

I have a content type named "film" and a form mode named "film_artistic" in my_module.routing.yml, I have added this entry: my_module.film.artistic: path: 'node/{node}/artistic/edit' defauts: ...
0
votes
0answers
9 views

Make a node field read only after the node has been created

I'm building a Drupal 8 module which will create several content types (with several fields) when the module is installed. The content types, field storages field instances, form displays & view ...
0
votes
0answers
4 views

Load custom fields with entityQuery

I'm trying to load a user by it's uid via an Entity Query, this seems to work, however i'm missing my custom fields defined on the Entity User. I'm getting all the default fields like 'username', ...
0
votes
0answers
6 views

Drupal 8 Views: filter taxonomy terms view by a term of another taxonomy of the same node

I have a content type "Product" with 2 taxonomies attached - "Brands" and "Product Types". Brands: - Brand 1 - Brand 2 - Brand 3 Product Types: - Glasses - Sunglasses - Contact Lenses ...
1
vote
2answers
17 views

How to display custom data array via Twig

I've created service which gets the raw data from custom content type. It looks like this : Array ( [front_page_slider] => Array ( [1] => Array ( ...
0
votes
0answers
10 views

RTL support base theme [on hold]

We want to create our custom theme based on Drupal 8. I had some search and in almost of theme suggests Classy or Stable.( Link1) my first question is are these themes RTL support ( my site is ...
0
votes
0answers
22 views

Refreshless doesn't work

I just tried to setup the RefreshLess module for my Drupal 8 site; after enabling it, I just see that some meta information is added to the DOM, but switching pages using links seems not to be ...
3
votes
2answers
51 views

How do I theme a link with twig for a specific content type?

I'm trying to create a custom file-link.html.twig for a particular content type. I've looked at https://www.drupal.org/node/2354645 which doesn't link plugin theme twigs like file-link but tried ...
0
votes
0answers
9 views

Rest OPTIONS route

I have a custom route defined which needs to respond differently to different types of request methods. It works with GET, POST, PUT and DELETE, however for some reason an OPTIONS call never reaches ...
0
votes
1answer
38 views

Get whole node by post type

Is there any way of getting a node by its post type? I've tried with entity query but it doesn't really work. EDIT: So far I've tried do it like this: $query = ...
0
votes
0answers
11 views

How to post summary and body using REST

I am using Drupal rest api in D8, to post articles. However, I would like to be able to post both the summary and body. Specifically, I am interested in learning how I can post body content, for the ...
2
votes
1answer
29 views

Programatically render a node in a specific language

I want to render a node display programmatically for sending it to a search engine. It works ok but is ignoring the language and renders the field labels in the source language (which is English). I ...
3
votes
0answers
13 views

How to use RegexConstraint with field?

I'm defining a base field for my custom content entity: $fields['machine_name'] = BaseFieldDefinition::create('string') ->setLabel(t('Machine name')) ->addConstraint('UniqueField') ...
3
votes
0answers
28 views

Import Json data into node

My goal is to import my own data set into Drupal 8 using Migrate modules (migrate_plus, migrate_tools). In drupal, I use Paragraph module, and here my trouble starts. I've build my own plugin to ...
2
votes
2answers
58 views

How to set a default theme programmatically

I am trying to build an install profile and I want to have my custom theme enabled and set by default after the installation. Adding in MYPROFILE.info.yml... theme: - my_theme ...is not enough. ...
0
votes
0answers
9 views

where are the facet blocks for search?

In drupal 8, I have added couple of facets at this page /admin/config/search/facets According to the documentation I should now have some blocks to put on the search page. But I do not see any ...
0
votes
0answers
17 views

How to force field deletion?

I'm stuck with uninstallable module. Drupal insists that there are Fields pending deletion and that module can not be uninstalled. I've run cron zillion times already as advised for such situations ...
0
votes
1answer
14 views

How can I update the field of the entity?

I have an "Question" entity, and I need to updates its 'key' field (of string type): My code isn't working: $storage = \Drupal::entityManager()->getStorage('question'); $query = ...
0
votes
1answer
15 views

How can I pass a variable to javascript from a preprocess function? [duplicate]

How do I pass $variables['is_front'] from template_preprocess_page() to a jquery script in Drupal8?
0
votes
1answer
19 views

Combining HTML markup to display it from a controller

i am creating the custom html as follows and i am calling another form inside that form . But for the second form its only display as 'array' , and not displaying the entire form as expected . in ...
-1
votes
0answers
23 views

I can’t log in after migration

I've migrated the files and database from Drupal 7 site to Drupal 8 site. Done plain drupal 8 installation, logged in using admin user for drupal 8 site. Ran upgrade process on plain drupal 8 ...
0
votes
1answer
14 views

Translate menu item made by view

Question is simple, in the views module you can add a normal menu item. But when in the menu itself it can't be translated. Is there anyway to do this, or should I just add the menu item myself ...
0
votes
0answers
7 views

Custom webservice with OAuth [on hold]

I want to create a custom webservice behind OAuth authentication, and I want to use the standard Rest capabilities in Drupal 8 together with the OAuth module. Does anyone have any resources in how to ...
0
votes
1answer
10 views

Setting #states property for a field_collection item added with the add_more button

This is a D8 question as the solution in Using #states with field collection doesn't work for D8. Here are the solutions I have tried, but none of them was working: 1- Adding an after build function ...
0
votes
0answers
25 views

I can't set a default value on hook_form_alter()

I have form alter for the user_register_form which is called. In this hook, I try to set a default value for a textfield but it doesn't work. I've tried all the syntax possible #default_value, #value, ...
1
vote
1answer
16 views

How do I have a dropdown select list for an entity reference?

For Drupal 8, the entity reference field displayed in form is a textfield with auto-complete feature for you to select the entity, is it possible to have it be dropdown select list instead? I have ...
0
votes
1answer
37 views

Logo is not displaying [duplicate]

This is the code I used in Drupal 7. <a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"> <img src="<?php print $logo ?>" ...
3
votes
1answer
27 views

“admin/content” filters not available anymore

In the Content page (/admin/content), in Drupal 7 there was a feature allowing to filter by content type, status or language: It doesn't seem to be available anymore in Drupal 8. Someone ...
0
votes
0answers
20 views

Preprocessing label based on input type?

I can use preprocess_input and get the input type using $variables['theme_hook_original'], which is fine. Is there any way at all do the same thing for preprocess_form_element_label? Basically I ...
-1
votes
2answers
40 views

How can I redirect node page for a content type to custom URL?

I need to redirect all the pages for a content type to a custom URL in Drupal 8. I used to do this in Drupal 7 by implementing hook_init() with the function drupal_goto() or by using the Rules ...
1
vote
1answer
24 views

How can I overwrite a hook from a theme

I have a custom sub-theme of the Seven theme. The Seven theme makes some node alteration via seven_form_node_form_alter(). I would like to have seven_form_node_form_alter() not run at all or I would ...
0
votes
1answer
67 views

How do I change the value of a button? [duplicate]

The value (label) of a button in a form that I want to modify is a Drupal\Core\StringTranslation\TranslatableMarkup object. The string is a protected value. How can I modify this string in ...
-1
votes
1answer
27 views

How to access the value of a Drupal\Core\StringTranslation\TranslatableMarkup object within a form?

I tried this : dpm($button['#value']->string but got this error: access protected property Drupal\Core\StringTranslation\TranslatableMarkup::$string Within a form object I need to be able to ...
0
votes
1answer
20 views

Where do I translate a string?

Where is the page in the administrative section where I can put the translations in Drupal 8?
-1
votes
0answers
7 views

Chat with Drupal 8 [on hold]

I want to create a chat in my website with Drupal 8 someone help me that what I use as plugins or modules
-1
votes
2answers
58 views

How do I get the form ID with hook_form_alter()? [on hold]

I tried putting the code below in my .module file but not getting anything displayed. Am I supposed to put anything else in the module file, or put this somewhere else? function ...
1
vote
2answers
30 views

How do i mark html TRUE in l()

In Drupal 7 we have option to mark HTML=>TRUE. How can i do it in Drupal 8 my code is $create_icon_path = 'my_icon.png'; //my icon path $create_icon = '<img height=15 src = "/' . ...
1
vote
2answers
30 views

Redirect after form submission

I create custom Form in Drupal 8 ,I remember we can redirect to custom path in Drupal 7 with set $form_state['redirect'] = 'mycustompath'; in custom submit handler, but how can redirect User after ...
0
votes
1answer
23 views

Drupal 8: Best practice to get nid in form_submit

I can get nid from within form_submit by using one of those snipet: $form_state->getFormObject()->getEntity()->id() or \Drupal::routeMatch()->getParameter('node')->id() If feel ...
1
vote
0answers
18 views

Drupal 8: set (sub) fields of the address field optional (not required)

I need an address field that allow the user to encode only a country OR a country with some other fields he could choose freely. I other words, I need an address field without any required field. To ...
0
votes
1answer
37 views

Placing block from a module not working

I've followed the tutorial to create a custom block from https://www.drupal.org/node/2101565 My module installed fine and I can see the block in the list of available Blocks for placing, but as soon ...
1
vote
1answer
66 views

How to upload file from a custom module?

I am trying to create one basic module for Drupal 8, where I have added one form with some textfields and multiple file upload element. Now on "submitForm" I am saving textfields values on database, ...
0
votes
0answers
15 views

Programatically create filters [on hold]

How to create ajax filters Programatically in a custom view? For example, I want to display a table data with three select lists. By default all data will display. When I change the first select ...
0
votes
0answers
14 views

Cannot redeclare class Doctrine\Common\Annotations\Annotation\Target

I'm regularly experiencing this PHP Fatal error: Cannot redeclare class Doctrine\Common\Annotations\Annotation\Target in ?uD on line 31 This ?uD string is random. I've seen so far among others: ...
0
votes
1answer
17 views

Where has module-specified HOOK_preprocess_page gone in D8?

I'm making a quick module whilst playing with D8, which I want to preprocess Stylus into CSS. The obvious choice for me, coming from D7, would be to use hook_preprocess_page, but it seems to have been ...
0
votes
1answer
11 views

Workbench moderation repeats “Save and ” in the button labels

My workbench moderation label is, for example, Save as draft, but the button says Save and Save as Draft. How can I get rid of that Save and , which is repeated for every button?
0
votes
1answer
29 views

How should I link (public) files to nodes?

I have many resources (mainly PDFs) that need to be imported to my site. Previously the files would manually be placed in sites/default/files/mydir and linked to the node like this: <a ...
1
vote
1answer
37 views

How do I set a cookie?

I need save a cookie for anonymous users in Drupal 8 when the user visits the site for the first time, which will be used to display a message. I can successfully save one using ...
0
votes
0answers
16 views

How to get to field items after entity is built but before field formatter view method?

I want to do some alterations to fields before they are displayed on an entity and it looks like it is not possible because the ...