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.

Filter by
Sorted by
Tagged with
0
votes
1answer
22 views

Display long text fields as type text input not as textarea on node forms

I have some fields which are configured as long text fields, which I need to display as <input type="text /> instead of <textarea></textarea>. I'm trying to find the correct naming ...
0
votes
1answer
42 views

Scoping an admin link to only show for certain node bundles

I have 2 node content types / bundles, A and B. each A has a relationship with multiple Bs. When on the edit page, node/%/edit, for A, I want to show a link to the list of related B so that an editor ...
0
votes
0answers
42 views

View with a relation 1 to N in the inverse side

I'm working on a Drupal 8.7.3 application and now I'm trying to build a view page for a content that is related in a relationship 1 to N, but it's on the inverse side. Let me clarify: I have products ...
0
votes
0answers
22 views

Listing two different custom entity types in one view

We defined two entity types, questions and answers. They are related to each other but we will need a view listing all questions and answers in order of title or created date for example. When you ...
2
votes
0answers
18 views

How can I purge unused translatable strings from the translation interface?

During the development, the wording changed quite a lot. When I generate translation jobs with tmgmt module (or by any other means), all the old wordings are listed as well. Is it possible to have a ...
0
votes
0answers
37 views

Get the value of password confirmation field register

I want to use the default register form to get the value of the password confirmation field on register. If a user change his password it will call my API ans send the new information. I can't find ...
0
votes
2answers
29 views

How do I make a profile select option on user registration?

I thought this was easy but normal fields and media don't seem to do what I want. I can use normal fields, because it is Drupal 8 and the user is an entity. So all I want to be able to do is: a) show ...
0
votes
0answers
34 views

Using REST to create user with CAS username

I would like my CAS server to POST an account to my client site when a new user registers. My CAS server is using D7, clients are using D8. Using the entity/user endpoint I can create a new user, ...
1
vote
1answer
54 views

Programmatically remove content from a group

In order to add a node to any group in Drupal 8, I use the following code. $group->addContent($node, 'group_node:article'); Now, for removing content from a group, I have tried $group->...
0
votes
1answer
91 views

Can't render node view mode programmatically

I try to render an HTML data from my node view mode but unfortunately, I have some small progress. I did some searching and modification on the others code Here. I have this now. $nid = 145; $...
0
votes
0answers
16 views

How to refer to the node created date in Computed Field PHP

I am using the Computed Field module in D8. I am trying to compute some dates using the node created date as the start point. As my first try, this code works: $valuein = $entity->field_datefield-...
0
votes
1answer
29 views

Auto-submit exposed form

I'm currently working on a views exposed form block. I want the form to auto-submit using AJAX, whenever an exposed filter is changed. I have searched for this, but I couldn't find any tutorial or ...
1
vote
3answers
106 views

Can I translate nodes and provide access to their translated content without the use of a site-wide language switcher?

Intended behaviour / question Writer creates /node/5001 Translator translates /node/5001 to french using all the niceties of the Content Translation backend system Visitor goes to /node/5001 and sees ...
0
votes
0answers
38 views

How to get the file ID using managed_file on custom form?

In Drupal 8, I have a custom form that I built using the Form API in a custom module. I am trying to upload a file using managed_file field. For some reason I can't get it to give me the file ID no ...
0
votes
0answers
39 views

View page count in Twig template

I can't seem to figure out how to get all this information in one line in a views template. <div class="pagination--totals"> Page @current_page of @page_count <small>(@total Results ...
0
votes
0answers
20 views

Admin file upload assigned to specific users

I'm looking for a way to allow the administrator to upload files. These files will be for specific site users (think receipts, test scores, etc) and can only be viewed by that specific user. Things i'...
0
votes
0answers
18 views

Rest Export View's “Link to Content” field is returning Original Server FQDN instead of Reverse Proxy FQDN

I have a Drupal 8 application behind a reverse proxy. Assuming that the FQDN for ReverseProxy is https://reverseproxy.com, and the FQDN for direct server access is https://directaccess.com. I've ...
0
votes
1answer
28 views

Field contains list and values of it are shown in one symbol

I'm developing a drupal module and there's a problem. I need to make a content type with some fields and one of them should have list with string values. But when I try to create content and choose ...
2
votes
2answers
43 views

Add a condition on dropdown selection

I have a dropdown in a node and the id of the dropdown is "field_b_status". I want to add condition in a rule if the drop down value is equals to one of the value "Complete" then send email. When i ...
0
votes
0answers
35 views

Updating custom entity field

I have a custom entity and wish to increase size of a varchar field. This gives helpful input: https://www.drupal.org/docs/8/api/update-api/updating-database-schema-andor-data-in-drupal-8 I added ...
0
votes
1answer
36 views

Overriding radio button rendering

I have a List (text) field on a comment type. This field is required and only one option may be chosen, so a radio button is how it will be rendered. I would now like to change the way the radio ...
1
vote
0answers
40 views

How to display the parent node or product of a comment?

I installed the Message module on my site. I created a custom module that created a message when a comment is created. https://imgur.com/a/4OLhGlL How to display the parent node or product of a ...
0
votes
0answers
23 views

How to update a content node's field value with a link (URL)

In Drupal 7, there was the ability to create a Rules Link in Views that passed arguments to a Rule that could update a single value in a node without having to use a form. How to do this in Drupal 8? ...
0
votes
1answer
12 views

Exposed filter or facet for a vocabulary listing select list

I have to create a form with a fulltext search field and a dropdown listing every terms of a certain vocabulary. On submission the form is redirecting the user with the value of both the fields as ...
0
votes
2answers
55 views

Error during config export

I have added one field in the content type. So when trying to export configuration it gives an error $ pwd $ /c/xampp/htdocs/Test/docroot/sites/testone.com $ ../../../vendor/bin/drush config:export -...
0
votes
1answer
31 views

Unable to add Quantity in Stock in Drupal Commerce 8 using Commerce Stock Module

I have enabled Commerce Stock Modules and its submodules 1. Commerce Stock API 2. Commerce Stock Field 3. Commerce Stock Local Storage 4. Commerce Stock UI Created a Product Type ABC and added a ...
0
votes
2answers
33 views

How to implement a text field formatter that renders a URL as the image?

If a node has a text field with the url of an image as its value, how can I render this field as the image? The image does exists it will be given the image url. I have to write that url into the ...
0
votes
0answers
9 views

Add a button on the login form

Is it possible to add a button on the basic login form? function alter_form_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { if ($form_id == 'user_login_form'...
0
votes
1answer
36 views

How to create a Tour on the homepage?

I created a Tour with the Tour UI module and I was unable to activate the tour on the homepage. The homepage of my site is the default view of drupal 8 with the machine name frontpage How to ...
0
votes
0answers
21 views

How to filter GraphQL query by content language?

I am coding Drupal 8/Angular app and Angular is fetching data from Drupal using GraphQL. Everything works fine except now I need to query nodes in a particular language. This is my query: { ...
1
vote
1answer
30 views

Sending file attachment in the email contact form

I have added a file field in a contact form. The client is receiving the email and there is the link of file. She now needs the file in attachment. Is there any module or code that could send the ...
1
vote
2answers
55 views

How to programmatically build a page and a form in the same page

What I'd like to do is build a page with two things: On one half of the page, custom markup with data from Drupal. On the other half, a custom form also submitted to Drupal. There are a lot of ...
0
votes
2answers
52 views

Run validation callback before ajax

The submit element on my form uses an ajax callback which sends out an email. I have a validation callback which I've added to this form, but it gets run after the ajax callback and so the email will ...
0
votes
0answers
32 views

Alter a Field Collection display order inside a FieldCollectionHook

I have been stuck in here since yesterday and I'm starting to run out of ideas. I have a Field Collection that contains 2 fields. The first one is a multiple taxonomy term, and the second one is a ...
-1
votes
1answer
39 views

Webform element validation custom module

I want to add a custom validation to text input, I followed the instruction provided in https://www.drupal.org/docs/8/modules/webform/webform-cookbook/how-to-add-custom-validation-to-a-webform-element ...
1
vote
1answer
64 views

Change field label used in node display

I have a custom content type in Drupal 8.6.x. I want to be able to change the text used for a field label based on the value of a taxonomy term reference in the node. For example, I want to change ...
0
votes
1answer
74 views

Why is $form array empty when extending FormBase or NodeForm

Why is $form not upcast with the requested bundle's fields for the default Form Mode for GET requests; and with the entities' values for other method requests? My form: namespace Drupal\tam_api\Form;...
0
votes
0answers
20 views

Import/export content to CSV along with the field collectors

I have added the "field collector" fields in the content type to create relation ship between 2 content types and they are looking good but i want to load the data for the content type from the CSV ...
2
votes
2answers
97 views

Allow some products to be sold only in bundles (groups) with some other products [closed]

I'm making a commerce site with Drupal 8 and Drupal commerce and I have a not so common request. Some of the products should be available to buy only in groups (bundles) with some other products. E.g. ...
0
votes
0answers
49 views

Set Custom Form Element Value in Extended LinkWidget Class

I have a class extending LinkWidget and would like to add a new form element. I have omitted all code except what I have added: class CustomWidget extends LinkWidget { public static function ...
1
vote
1answer
20 views

Is there a standard place 3rd party module pages report what PHP version they're tested on?

Is this info reported anywhere? for e.g. https://www.drupal.org/project/optimizely or https://git.drupalcode.org/project/optimizely
0
votes
0answers
11 views

How do I retrieve tagged nodes as well as untagged?

I have a View, "Product Reviews", that retrieves all Product Review nodes (custom content type) that are tagged to the Product you're currently viewing. So, if you're on the page for Product XYZ, this ...
0
votes
2answers
39 views

How to achieve clean HTML markup?

If you visit official website of Dries Buytaert https://dri.es/ and look into the source you will see very clean and minimal markup with no unnecessary tags and classes, eg: When I create a simple ...
0
votes
1answer
33 views

How can I set value to hidden field (Form Api) and send them with post method?

I’ve created a form with Form Api in a custom module. I send datas with post method to a web service. In buildForm() $form['mode'] = array( '#type' => 'hidden', '#value' => '...
0
votes
0answers
23 views

Replace the first tab in the user profile

In the user profile, I try to replace the first "View" tab with a new tab with views. So I add in "Page settings", for Path: / user /% user, and Menu > Title link menu: My tab > Parent: user ...
0
votes
2answers
22 views

Node ID from hook_comment_insert [duplicate]

I need the ID of the node the inserted comment is attached to. This is what I have tried: function my-module_comment_insert(Drupal\Core\Entity\EntityInterface $entity) { // According to https://...
1
vote
1answer
28 views

Disable “Operating in maintenance mode. Go online.”

The solution for Drupal 7 is using the following code, as per answer of How can I disable the message “Operating in maintenance mode. Go online.” in maintenance mode? function mytheme_preprocess_page(...
0
votes
2answers
54 views

How to install a specific version of Drupal using Composer

Composer always installs the latest version of Drupal core, I want 8.6 not 8.7. How can I achieve this?
0
votes
1answer
24 views

Following Drupal 8 Commerce custom offer tutorial, but getting “name already in use” error

I am following the tutorial for creating a custom offer at the official Drupal 8 Commerce documentation. But I'm getting an error that I pasted below when I click on any of the conditions, and none ...
0
votes
1answer
68 views

Access fields of node content type from event “rules_entity_insert:comment”

In Rules 8, I know how to make custom fields of a content type accessible in an event "After updating a content item (rules_entity_update:node)", that is: Condition: Entity is of bundle Entity: node ...