Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [8]

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

1
vote
1answer
26 views

How can I read config schema from a config entity?

I need to read the schema definition from a config entity, which is located in config/schema. For example the schema from a node type defined in node.schema.yml: node.type.*: type: config_entity ...
0
votes
1answer
551 views

Assign roles at registration

I am trying to assign a user role at registration using Webforms in Drupal 8. Is this possible or is there another form module that would do it better? I have two user roles 'Venue' and Artist' which ...
-2
votes
0answers
26 views

Equivalence of module elysa cron on drupal 8? [on hold]

I am a beginner in D8, I would like to know if there is an equivalence of module Elysia Cron that can manage cron on Drupal 8
0
votes
0answers
8 views

Why do I get “Type does not correspond to an entity on this site” when POSTing to REST api behind an Apache Reverse proxy?

I have the REST api configured to allow POSTing new users to /entity/user. On my local machine, it works just fine. Once I push up to my remote host, it stops working. The key difference is that on ...
2
votes
1answer
481 views

How to print and/or manipulate individual image attributes and suppress width and height via the image.html.twig template

I had to get rid of the width and height attributes in my images and wanted to learn better the possibilites of Twig in Drupal.
0
votes
0answers
17 views

Open a modal form on user login submit

I have user login page, when user login in the site successfully, user should be redirected to the their edit profile page in modal. Following code do the redirection to the edit profile page, but i ...
1
vote
1answer
34 views

Passing an array stdClass Object from custom module to template

I’ve created some D8 custom modules which call rest API and and it’s working fine when I get simple array in my $response. In my controller, this is working : return [ '#theme' => '...
0
votes
0answers
22 views

Can we make 2nd field required only if 1st field is filled in a custom composite field?

I am using custom composite field in one of my webform form . It has 4 fields and i want to make 2nd field as required only if 1st field is filled .How can i do this? I had added field2 as required ...
0
votes
1answer
346 views

Is it possible to create an auto-increment field in a content type?

If I am creating a database in MySQL, I can create an auto-increment field for a table. But is it also possible to create an auto-increment field in a content type in Drupal 8?
0
votes
0answers
20 views

Modifying Page Title To Be Separate From Browser Title [duplicate]

I have a module that contains multiple forms, each form in its own file. I need to modify the page title such that it is different from the browser title for several of these pages. The name of the ...
0
votes
1answer
17 views

How to customize entity print pdf

I've installed Entity Print in order to create PDF files. I've read the documentation to enable a twig template to customize the pdf output, but I don't know how to do simple things, in the twig file, ...
0
votes
1answer
43 views

Capture amount on order state change

I would like to know if it is possible to capture payments by subscribing to order transition events. Example: Transaction mode: Authorize only On order placed - Capture some amount (application fee)...
0
votes
1answer
21 views

Page not found while create custom form

I am a newbie in Drupal 8. Today I have created a custom form in Drupal 8. Here is the folder structure and here is my routing.yml resume.form: path: '/resume/myform' defaults: ...
1
vote
2answers
510 views

How to add a class to menu items that are not expanded (or don't have children) in the navigation Twig template?

How do you add a class to menu items that are not expanded (or don't have children)? {% for item in items %} {% set classes = [ item.is_expanded ? 'menu-item--expanded ...
10
votes
3answers
5k views

Get the list of all content types

How do I get a list of all the content types defined in a Drupal 8 site? In Drupal 7 it used to be node_type_get_types(), but it has been deprecated. I tried Entity::loadMultiple() but it doesn't ...
0
votes
0answers
34 views

HTTP Client Manager $request->getStatusCode() == 200 return?

When I read this HTTP Client Manager docs on Drupal, I don't understand why it returns the $build when $request->getStatusCode() == 200, is that supposed to be not equal 200? I also copy and paste the ...
4
votes
1answer
71 views

Benefit of config entities over regular config entries?

In Drupal 8 it is possible to store configuration in "config entities". However, the same can also be achieved with non-entity config entries. E.g. one example for a config entity schema, from core....
1
vote
1answer
470 views

Implementing an age check using InboundPathProcessorInterface

I'm trying to create an age checker for a Drupal 8 site. I've created a custom module which has a form where the user enters their DOB and my form submit saves a cookie so I know they have passed ...
3
votes
2answers
2k views

How do I implement the equivalent of hook_url_inbound_alter()?

I'm working on a module which will resolve URLs to entities by altering inbound URLs so that if they contain an entity ID with following pattern "-{entity_id}" user will be redirected to correct URL. ...
0
votes
0answers
17 views

Drupal 8 : Multiple Submit Handler

I am using Drupal 8.6 for creating custom module in Admin. I have a custom form where i have to use multiple submit button for form submission. I am not able to submit the my form to specific function....
2
votes
2answers
1k views

How do I build Breadcrumbs for a certain node?

In a node preprocess hook I am getting breadcrumbs for the currently viewed node by doing the following: $vars['breadcrumb'] = Drupal::service('breadcrumb') ->build(Drupal::routeMatch())->...
-2
votes
1answer
24 views

I want to make a Drupal 8 view with contextual filter

I want to make an intelligent view and want to pass contextual filter. If the contextual filter value is passed in the url so only display the article having the id like http://example.com/article/2. ...
0
votes
1answer
67 views

Is there a way to render a node with view mode via token?

Is there a way to render a node with view mode via token? Like: [node:5:teaser]
0
votes
1answer
34 views

Responsive Image Module is only selecting fallback image style

I recently tried implementing drupal 8's Responsive Images Module. I studied about it's basics and implemented according to the guides available online. But when i try to use it on any image on the ...
-1
votes
0answers
18 views

Select options shown in wrong order [on hold]

So I have a form element like this: $form['country'] = array( '#type' => 'select', '#options' => mymodule_country_select_list(), '#title' => t('Country'), '#required' => TRUE, '#...
0
votes
0answers
64 views

How can I display the Flag token on my message?

I have the Message module in Drupal 8 and I have created a Flag to mark the Message. The machine name of my flag is mark_message How can I display the Flag token (the link of the flag to mark and ...
0
votes
0answers
27 views

View escapes node's text field HTML

I've looked at other posts but been unable to resolve the issue. I have a Text field (formatted, long) in a content type, when the node is viewed the HTML in the field displays correctly, when I view ...
0
votes
1answer
356 views

How do I programmatically render a view that has exposed filters?

I can call a view with contextual filters without any problem, but when I add exposed filter value $view->setExposedInput to the call, I just does not work, the exposed value is not applied and being ...
-2
votes
0answers
29 views

Keep content private

How is it possible to keep the content created within a group (from the Group module) private? Maybe I forgot something in the group setting, but the content can be seen by not authorized users. In ...
0
votes
1answer
20 views

How to get taxonomy term values?

In my user entity, I have a term reference. In that vocabulary, I have a regular field. How can I fetch that field's value? I tried the below in devel/php to no avail. $user = Drupal\user\Entity\...
-2
votes
1answer
11 views

How to extend better exposed filter?

I use "Better Exposed Filter" for my view in Drupal 8. I have included taxonomies into the filter, which have 3 levels. Is there a way to extend better exposed filter module to display taxonomies in ...
1
vote
0answers
25 views

Adding pre built create-react-app to D8 block [on hold]

this is my first question here!, so strap on in as this will be good! I want to know how to add a pre "built" react app to a block, created with `npx create-react-app reasons are i want to use a ...
0
votes
1answer
703 views

How do I throw values calculated back to buildForm()?

I am trying to throw back values that are calculated in submitForm() to buildForm(). How do I add more state values into it? /**  * @file  * Contains \Drupal\resume\Form\ResumeForm.  ...
0
votes
1answer
349 views

Twig get field value from panel page

I am trying to get the value of a field that is displayed in a panel page. I might be going about this all wrong, because I'm still getting used to Drupal 8. I want to display book information, ...
0
votes
0answers
28 views

Imported Image Style Edit Form Error

I am getting an error accessing the edit form for imported image styles. *Tested on Drupal 8.6.13 and 8.7.3 Create image style in UI. Export image style. Delete image style in UI. Import image style....
0
votes
1answer
424 views

How do I programmatically set contextual filters?

I need to set a contextual filter programmatically and almost every view I have will have this filter. However, some wont and will have other contextual filters instead. I have tried following the ...
0
votes
2answers
523 views

Dynamically changing the href on a link with data-dialog-type = modal does not work

For reference I am working on this issue for the Focal Point module... I have a link whose href is updated dynamically using js based on a particular user interaction (moving the focal point on an ...
30
votes
6answers
18k views

Programmatically create a term?

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 ...
0
votes
3answers
32 views

Webform dynamic select options based upon another element's state

Say there are two select elements with dynamic options (via an options alter hook, sourced from an external resource): A and B. There is also a datasource that provides a relationship that determines ...
0
votes
0answers
10 views

Altering Shipping/Billing address inline entity form

Now that Drupal 8 Commerce moved to Inline Entity Form approach. I am having trouble of altering Address for fields for the checkout... In the past I could do this: function ...
0
votes
1answer
1k views

Alter a query using <module>_views_query_alter to filter a view by month

I successfully created a view gathering, let's say, events, sorted by date. I also created exposed filters so one could filter the view. I'm attempting to create another exposed filter that would ...
0
votes
0answers
42 views

Ajax dependent drop down not working on form rebuild

I have a drupal custom form with two ajax dependent dropdown fields and five normal text fields. on form submit, all things are working fine except validation of form fields. when I put validations on ...
0
votes
0answers
8 views

Search result page with tabs and ajax pagination

I need to create a results search page with those characteristics: The page will have different tabs (like the bootstrap ones so no page reload), each tab will only shows the relative content type. ...
1
vote
1answer
2k views

How to update a menu link created with MenuLinkContent::create()?

I know how to search for menu items created with *.links.menu.yml: $menu_link_manager = \Drupal::service('plugin.manager.menu.link'); $menu_links = $menu_link_manager->loadLinksByRoute('user.page')...
0
votes
0answers
29 views

Automated testing strategy for Twig templates [on hold]

I am using Drupal 8 CMS for a media platform, which essentially uses twig templating engine. We are using component based approach, building small re-usbale building blocks instead of building the ...
0
votes
1answer
530 views

printing an entity reference field in a special display mode

I have an entity reference field. The referenced entity has multiple display modes. I'd like to print this field 2 two times in a template, with 2 different display modes like so: {{ content....
2
votes
1answer
365 views

How can I create multiple cropped Media images without re-uploading them?

Solutions that I've found allow to crop Media, type Image when I've uploaded an image, but the media entity is not yet created (on the "Add media" page). I need to upload a large full image once (and ...
0
votes
1answer
571 views

How to apply js and css to ajax loaded content?

When content get loaded through ajax, neither theme.css or js get applied. Below is code snippet, controller $twig = \Drupal::service('twig'); $twigFilePath = drupal_get_path('module', '...
-1
votes
1answer
34 views

JS function undefined although JS framework attached

I attached materialize to my library theme. global-styling: version: VERSION css: base: materialize/css/materialize.min.css: {} css/style.css: {} js: materialize/js/...
0
votes
0answers
27 views

Get Translated Config

I've followed a few tutorials on how to set up a custom settings form and create translations. All this seems to work, but after adding a translation, I am unable to get the config settings for that ...