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
0answers
28 views

How can I update an user field via JSON:API?

How do I update user field via JSON API with D8? EndPoint:https://domainname.com/jsonapi/user/user/ Method:PATCH Request Header; Accept:application/vnd.api+json Content-Type:application/vnd.api+...
0
votes
0answers
20 views

How can I login via REST?

I am trying to login via REST API in Drupal8. Many people in the web are suggesting to post in the below format: POST: http://example.com/user/login?_format=json Content-type: application/json Data:...
0
votes
0answers
20 views

How to display a set of custom contents in Taxonomy URL?

I am working with Drupal Commerce using core Drupal 8 and the type of data I am using is Product. When I tag a product with a taxonomy term and visit page for that taxonomy term, I don't see anything. ...
0
votes
0answers
36 views

Error “The value you selected is not a valid choice.” in drop down list

I want to list node titles in drop-down list programmatically. I have done below code in form_alter hook. function product_custom_form_alter(&$form, FormStateInterface $form_state, $form_id) { ...
1
vote
1answer
40 views

How do I add default header and footer regions to my site?

i have added regions in my theme.info file. now i want to add default header and footer with logo in all the pages of my site.This is my page.html.twig <div class="layout-container"> <...
0
votes
1answer
53 views

DrupalSettings are not passing the values from block to js?

I have been trying to pass the variables from block to jquery. In Block.php, return [ '#theme' => 'block--exampleblock', '#value' => 'test', '#attached' => [ '...
0
votes
0answers
40 views

Display block when boolean field is checked

I currently have a custom block (created programmatically) thats displays on my news content type (via Layout builder). The code I used for block is below. class NewsButton extends BlockBase { /**...
0
votes
0answers
18 views

Getting a book tree/menu programatically

Given a node ID, how do I display the outline of the book it belongs to? I'm dispatching the pages of the book from a custom, variable, route (and not the alias of the node) so the default book ...
0
votes
0answers
24 views

'Drupal\user\EntityOwnerTrait' not found

I upgraded from 8.6.15 to 8.7.0 and now my page will not load. I've searched for the error I'm getting (see below) but the results do not seem to apply to my situation. I'm using installatron from ...
0
votes
0answers
18 views

How can I stop a feeds import process?

I created a csv Feed that would create new content. I uploaded the csv file and started an import job. Unfortunately, the csv file had some headers that did not quite match those defined in the Feed....
0
votes
1answer
40 views

In Views, display additional fields from an entity reference

I have a content type with a field that is an entity reference to another content type called "URLs", and the "Allowed number of values" is set to "Unlimited", meaning that one record can have ...
0
votes
0answers
22 views

How to retrieve information from the parent store of a product?

I have a site with Drupal 8.7 and Drupal Commerce 2.14 I created a template for my stores : commerce-store--professionnel--full.html.twig And I added this code : <div class="col-xs-12 col-sm-12 ...
0
votes
0answers
9 views

Default contextual filter to current user but prevent altering the value in the URL

So I have the following content types: User: The default drupal user Document: Title Body ... Linked User: Entity reference (User) Please note that the Linked User does not reference the Author of ...
0
votes
0answers
21 views

How to add layout or panels to my custom page?

I'm creating custom layout to use for my custom page that has 4 horizontal regions. But i'm not sure how to fetch the layout in my custom page.i added below code in my mycustomtheme.layouts.yml ...
0
votes
1answer
24 views

Is there a way to create hierarchical taxonomies checkboxes?

I have an issue where I want to keep sub category inside a parent category. Say, for preferred vehicle I want a checkbox like this in node creation form []Car []Volkswagen []Toyota []Bike []...
0
votes
1answer
38 views

paragraphs_update_8018 takes very long time to finish

The paragraphs_update_8018 update takes very long to complete (we have over 1 mio. paragraphs), as of now it's already been over 1h40m and it's still running. EDIT: it finished after 1h47m My ...
0
votes
1answer
40 views

Plugin Not Found Exception

I am implementing REST in Drupal 8. I have created a custom plugin for REST resource, enabled the plugin and configured permissions for that REST endpoint. After few days, I removed the code for ...
-2
votes
0answers
49 views

Custom YouTube preview image in node detail view

Presently I am using https://www.drupal.org/project/video_embed_field. Now I can embed YouTube and Vimeo videos finely in my website. I want to display my own preview image rather than YouTube/Vimeo ...
0
votes
1answer
28 views

Entity Validation API: Retrieve parent field entity while validating

I'm using the Drupal 8 Entity Validation API. I've implemented my Constraint and ConstraintValidator classes and added them as a constraint against the relevant entity field. If I understand the ...
0
votes
1answer
41 views

Custom line items to be included in $order->getTotal()

I am using Ubercart for our e-commerce on Drupal 8 website. Everything seems to be working fine except for the $order->getTotal() function - it does not somehow pickup the amount from my custom ...
0
votes
0answers
11 views

How can I set a Custom Field's label to 'visually_hidden' by default?

So I created my own field plugin, and I wonder if it's possible to set a default value for the display option. Obviously, there's no way to set this in the field formatter, and I don't see where I ...
-1
votes
2answers
54 views

JavaScript dependencies for a specific block or page [duplicate]

I am migrating a Drupal 7 site to Drupal 8. I have a custom block (visible only on the home page) that has some tabs on it. Currently, the tabs are implemented using jQuery UI tabs and it would be ...
2
votes
1answer
58 views

Have followed instructions to disable cache for development but it's still caching

I have followed all the instructions here https://www.drupal.org/node/2598914 I'm developing a module with a block, and when I went to the Block Layout page and clicked "Place Block", the list of ...
0
votes
0answers
19 views

Print Select Option HTML field in View's PHP Header

Following code I am using in PHP Block of Header in View Page <?php $query = \Drupal::entityQuery('node'); $query->condition('type', 'media')->condition('status', 1); $results = $query->...
0
votes
1answer
24 views

How can I programmatically apply text formats?

I've created a custom text format I'm trying to apply to a field programmatically. As best I can tell, the format IS getting applied, but it is not stripping HTML tags like it is supposed to. The ...
0
votes
0answers
24 views

Upgrade Core to 8.7 and “Content” nodes no longer display

I recently upgraded my Drupal core to 8.7.7 through a manual update (from 8.6.1) Initial inspection looks good, no DB update errors. When i go the "Content" tab of the admin panel (/admin/content), I ...
0
votes
0answers
35 views

After installing commerce and commerce license I'm getting the install screen

I've installed commerce (latest version) on Drupal 8.7.7 using composer. Installation goes fine but as soon as I create a product variation or even when I install commerce license, the website ...
0
votes
1answer
29 views

Syntax to use form_alter with array in name attribute

I would like to modify some custom fields with form_alter in a contact form. I know for example how to change placeholder for this "name" field : Note : I removed all the unnecessary html elements ...
0
votes
1answer
19 views

How we can get the value entered in search API autocomplete field in jQuery?

I got a requirement to send the search text to GTM for tracking purpose. I have a field which is from search api autocomplete module. I am not getting the value in jQuery on click of submit button. I ...
1
vote
2answers
95 views

How can I add a link on the “Structure” admin page?

I created a view page with the path being /abc and I want to add this link on Administrative page with a link in Drupal 8.
0
votes
1answer
20 views

How to limit the words in search api autocomplete suggestion?

I have a requirement to limit the words to show up in row of autocomplete suggestion. Now its showing titles but problem is titles are too long and suggestions are covering entire width of the screen. ...
-2
votes
2answers
28 views

Reduce navbar min-height without modifying or adding css files

I have successfully installed and configured Drupal 8 I am using bootstrap project as theme The height of the navigation region on the top is as default has a css navbar which has min-height 50px as ...
1
vote
1answer
95 views

Updating without Composer

I've previously used Drush to update my Drupal-installations. They are installed without using Composer, and currently on version 8.7.3. However, when I try to use Drush (drush v8.1.15, using drush up)...
0
votes
1answer
32 views

CKEditor add custom class to table

I want to add a class to a table inserted in CKEditor. I have tried to add a custom style using the styles dropdown and add this line, table.my-custom-class|Table, but when clicking on the table the ...
1
vote
3answers
74 views

Set label of $entity programmatically in a custom form

I need to change the label of a custom content type programmatically. I've looked around but I couldn't find a solution. This is my custom form: class GroupContentForm extends ContentEntityForm { /...
0
votes
0answers
31 views

How to alter search api autocomplete to exact match?

I have installed search api autocomplete module. I have configured it also but the requirement is to it should search only 'starts with word'. now the result is searching if a word present in mid of a ...
0
votes
0answers
22 views

How can I only show the current book on book navigation?

I have a list of books and I would only like to see the current book on the book navigation. How can I achieve that?
-4
votes
1answer
34 views

Block with Listing of custom links to redirect to pages

With Drupal 8 I want to have a block with a select list that I get programmatically from taxonomy terms and when the user clicks on Submit it redirects the user to the page I put in the list. What is ...
1
vote
0answers
48 views

How do I add a script just above the closing body tag?

How do I add a script on Drupal 8 site/app just above closing body tag? Vendor provided some JS in the following form: <script> ... code </script> Asked me to place immediately ...
1
vote
1answer
19 views

Default all entities to English

At some point we will be enabling translations on all entities in Drupal 8. However, we are not ready yet so in the meantime we would like to set all of the entities (content types, taxonomy terms, ...
1
vote
1answer
35 views

Format for webform submission node tokens?

I have a field on my webform node which is an entity reference to a taxonomy term. I'm printing it in the webform using the token [webform_submission:node:field_sports], which prints the field output, ...
1
vote
1answer
18 views

Token to get the last component of [node:url]

I'm using [node:url:relative] but my path has multiple parts /content-type/node-title . I would like to get only the node-title part. Alternatively, a token that give me the node title transliterate ...
0
votes
0answers
54 views

Programmatically creating paragraphs is extremely slow

I am adding paragraphs from xml file programmatically but it is extremely slow. for example I'm basically creating paragraphs like this: $row = ['field_title' => 'title', 'field_id' => 'id' .......
0
votes
0answers
27 views

How to install Drupal 8 with composer on Apache server?

I want to install Drupal 8 with the drupal-composer/drupal-project on a server with apache in the public_html folder. The issue is that I want to maintain the folder structure /projectname/web. So, ...
0
votes
0answers
20 views

Unable to alter OEmbed remote video providers

I'm trying to add a remote video provider for OEmbed. I'm using the hook_media_source_info_alter to change the OEmbedDeriver class like this: use .../CustomOEmbedDeriver; /** * Implements ...
0
votes
0answers
34 views

503 Service Unavailable error in all pages except added to my route file

I have a D8 web with some views and pages. If I log in with administrator user, all works good. If I log in with a normal user, I get 503 service unavailable error after some seconds of load. It ...
2
votes
1answer
40 views

How do I return a Twig template inside the build method of a block class?

Am new to Drupal and this week I learned quite a bit about module development, and for today the case is: For my new module, I create a custom block that renders a markup, and from the folder ...
-2
votes
1answer
43 views

fix-permissions.sh for Drupal 8

With Drupal 7, when I upload a project from local to server, I usually run fix-permisions shell script to change owner and permissions of folder/files. Is provided in : https://www.drupal.org/node/...
-1
votes
1answer
16 views

Can I add a menu link with a parameter? [duplicate]

I would like to add a menu link using the "Link"-Field with Autocomplete, but I would like to add a parameter afterwards. Pretty much like this: ...which is not working. Is that possible? Thanks!
0
votes
0answers
25 views

How can I theme a paragraph on admin edit pages?

I'm struggling to override the template on the admin interface for a content type. I'm going to need to do several modifications to the edit form to meet the editor's requirements, however, I seem to ...