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
votes
0answers
22 views

How to add Global PHP field in Drupal 8 views? [on hold]

I want to add a Global PHP field in Drupal 8 views to add custom PHP field. How can I add this? Any module is available for above scenario?
0
votes
0answers
27 views

How to add a token with the flag to the Message module?

I have a site on Drupal 8 with the Message, Flag and Token modules. I created a custom module to create a message when an entity is created on the site. I also created a flag to mark messages as ...
0
votes
0answers
22 views

How do I update the progress indicator?

Does anyone here know how to update the progress indicator in Drupal 8? I've done this in Drupal 7 many times with code similar to here (using URL & interval) http://api.drupal.org/api/drupal/...
0
votes
0answers
29 views

Error when adding a custom field

I created a module for custom field but when I activated it I no longer had access to the field add page. Fortunately, @Kevin helped me see where the mistake was; thank you to him. Now I have access ...
0
votes
1answer
29 views

Content entity doesn't load on edit

I have a custom entity, BaseEstablishment which is an abstract base class, implemented by Practice. abstract class BaseEstablishment extends ContentEntityBase implements EntityOwnerInterface { // ...
-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
0answers
18 views

Check if a user has already created a node and redirect the user when the node exists

I am trying to redirect users to a page when they have already created a node in mytheme.theme, in order to prevent a user to create a node twice. function mytheme_node_prepare($node) { if ($node-&...
0
votes
0answers
12 views

Setting default value to custom fields in menu items

I created a custom boolean field in my menu item using this hook_entity_base_field_info function Mymodule_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) { if ($...
0
votes
1answer
22 views

How can I render an HTML table in a block?

i have created a module for showing third party API data here is some data returned from that API {"ObjectId":43,"ObjectName":"MEGA MELA","ObjectTitle":"Event Created by API","ObjectDescription":"...
-1
votes
0answers
14 views

Custom entity won't install [closed]

I generate a custom entity for custom module with drupal generate:entity:content. When I run drush updatedb --entity-updates, it doesn't anything, on the database. Something to edit before to register ...
-1
votes
1answer
31 views

How to Restrict some special character in password field

I'm very new in Drupal, I would like to restrict some special characters from user password field Is there any way to edit configuration of core modules i'm trying to create preg_match modules . i ...
0
votes
0answers
26 views

Initial values in forms elements

When I create a form (using form api) I need, sometimes, to assign a default value to form elements, or to create a list for select elements, under certains conditions. In this cases, I need to do ...
1
vote
1answer
36 views

Field collection item code not working

Hi Every one I am trying to create new field collection item programmatically but code is not working. I want to create a number of field collection items but no Luck. My code is following. use ...
0
votes
0answers
60 views

Loading a view page is very slow

On Drupal 8.7.3 and a very powerful VPS server with php 7.2, I have a view (page) that will list all available nodes of a specific content type. The display of the view is "Footable" taken from the ...
0
votes
1answer
19 views

How to attach media item created during migration to media field in node

I am migrating content from Drupal 7 to Drupal 8. There is an audio field that I am currently moving to media via a custom process during migration. When I get the id of the new media created I can't ...
0
votes
0answers
17 views

How to add an additional link into node links array programatically?

I would like to add a additional link into the links list of my node-type teaser-display (where "write a comment", "read more" link are located). Also I would like to pass some tokens (token module ...
0
votes
1answer
24 views

How to add unique class to each checkbox elements

I am displaying checkboxes using form API in Drupal 8. For functional and theming purpose I need to add unique custom class to each checkbox element. Is there any way to add classes to each checkbox ...
-1
votes
1answer
37 views

How to make IN condition? [closed]

I have table with this structure id, brand, email, url and I want to make this kind of query but I cant find how to put IN condition. SELECT email FROM `table_name` WHERE brand IN ('VW', 'Volvo'); ...
0
votes
1answer
22 views

Can't access Main menu and can't do drush updb after update

I update Drupal to 8.7.3, but now I can't access my Main menu (admin/structure/menu/manage/main) and can't do drush updb? I have PHP Version 7.2.19 I get this log error: Drupal\Core\Database\...
0
votes
0answers
73 views

Adding jQuery to a webform

Trying to count selected radios in a webform, I managed to make it work outside drupal (please see link below) but I'm not sure how to add it to my theme/webform. https://jsfiddle.net/j9q75Lay/ I ...
0
votes
0answers
29 views

How do I make comment URLs include the node URL on which they are displayed?

Default URL for comments is comment/1#comment-1. I would like it to be [node URL]#comment-1 where [node URL] is the URL of the node on which the comment is displayed. I have tried to use the pathauto ...
0
votes
1answer
29 views

How can I purge a specific URL from varnish cache without making a curl request?

I'm programmatically updating images and keeping the same file name. I flush the image styles for the image when I do this, but I'm running into an issue where my image styles aren't being regenerated ...
0
votes
0answers
20 views

Add a custom reset button to a view page

We have a myview which as as a page display where the path setting is set to /mypath. On this page, we have an exposed form (exposedform_myview_page1) for searching the Article titles and a facet ...
1
vote
1answer
27 views

How to filter Views records by day-of-week, including multiples

I have a need to filter many records by the day of the week derived from a date-only field in those records (i.e. not today's dow). I would like a solution that works with views filters, as the wider ...
0
votes
0answers
19 views

How to display number of comments of a node as part of a “content” view with fields

I created a content view in D8, which shows me fields of a content type. Basically it works. Now I would like to have the total number of comments per listed node displayed as a view field ...
1
vote
2answers
50 views

Fetch view results from mymodule_preprocess_page hook

We have a View page that is coming from myview. Using the header setting in the view we have added @total results already, which displays in the views-view--myview--page-1.html.twig using the {{ ...
0
votes
0answers
13 views

Reserve stock on order complete not working

I am working on Commerce 2.x and I am trying to reduce the stock value when someone adds an item in the cart. When I check the stock config there is an option to check the Reserve the stock on order ...
-2
votes
0answers
76 views

Issue on updating modules in Drupal 8 with composer [closed]

I've updated the core to 8.7.3 Then I started updating the modules, but that went wrong ... [name]$ composer outdated "drupal/*" drupal/blazy 1.0.0-rc4 2.0.0-rc3 Provides basic bLazy ...
-1
votes
0answers
14 views

Commerce Purchase Order for drupal 8.7.2 [closed]

I have some users on my Drupal 8.7.2 website who need Purchase Order instead invoice. So, I have installed Commerce Purchase Order for Druapl 8 from here. I tried to checkout from my website and get ...
0
votes
1answer
32 views

How to modify a form to have some field surrounded by 'Details'?

I created a custom content entity with Drupal Console. Three of its fields are defined this way: // ---------------------------------------------------------------------------- $weight++; $...
0
votes
1answer
20 views

Accessing the uri within the template_preprocess_image_formatter

I am using template_preprocess_image_formatter and I am trying to access the uri protected property inside the URL array (see screenshot) does anybody know how to access it?
-2
votes
1answer
32 views

How to trim title for mobile devices?

I am working with Drupal 8 website, on my view I have a list of contents. Some titles are pretty long, what is fine for teh desktop view, but for mobile version I need to trim the tite up to 30 ...
0
votes
1answer
37 views

How to handle exceptions in a batch process

I have some special configured content entities in my system which are protected in a pre-delete hook against entity deletion. There is also a batch process (VBO - entity delete) where they can be ...
-2
votes
1answer
26 views

in drupal i want to change the form element value ,if the user clicks on other option in select list in drupal [closed]

i am new to drupal 8 , i have a drupal 8 custom form and it has one radio button form element , whenever the user click on other option i am displaying the hidden user input element , the issue i ...
0
votes
1answer
37 views

Migration via phpmyadmin

We are moving to a Drupal distribution. From all the research we have done, there is no easy path to do Drupal 8 to Drupal 8 migration. We are looking to copy some content via phpmyadmin. Data we ...
0
votes
0answers
23 views

PluralTranslatableMarkup does not return plural value

The code bellow should return plural. use Drupal\Core\StringTranslation\PluralTranslatableMarkup; $trans = new PluralTranslatableMarkup(12, 'singular', 'plural'); $output = '' . $trans; $output1 = $...
0
votes
0answers
22 views

Error: Cannot call abstract method while using getForm() [closed]

I am trying to build a custom ajax submit driven form and trying to load that form inside custom controller. This is the form namespace Drupal\mymodule\Form; use Drupal\Core\Form\FormBase; use ...
0
votes
1answer
18 views

D8 | Custom Form managed_file field limit number of upload files

I have a custom form in D8. Form has managed_file field. I am facing challenge regarding the limit of number of files upload to this field. I have to make this managed_file field to upload only 3 ...
0
votes
1answer
23 views

Close webform modal and redirect to entity

I have a webform that opens inside a modal. Everything works fine. Then I had the problem of closing the modal after the form was submitted. I fixed that to with the help of the following link: https:/...
0
votes
1answer
29 views

How to get the enabled manage displays per node type?

I have an admin form and need to check if a node, e.g. article has a specific manage display enabled. How do I get the data? Found out to get an array of all available displays in general and there ...
0
votes
0answers
29 views

Skip updating certain themes/modules on composer update

My setup is composer driven. I have overridden some module with patches and customised a contributed theme (boostrap_sass). Now I want to avoid overbidding these modules and theme when I perform ...
-2
votes
0answers
33 views

CKEditor text area grows taller than screen when text is long

This may not be specifically tied to Drupal, but it seems to be connected, so I'm posting here first. In a node edit form, when I save long text in CKEditor and return to the form, the CKEditor text ...
0
votes
2answers
38 views

Is there a way to run drush updb without going to maintenance mode

I have a live site which runs on drupal 8. I am using drush 8.5.3 with the installation. Whenever I run drush updb the site automatically goes to maintenance mode. Is there a way to do this without ...
0
votes
1answer
36 views

Display Themed 'username' in Block

I am trying to display the themed username in a custom block. MyCustomBlock.php: public function build() { $usersData = \Drupal::service('user.data')->get('my_module'); $usersFromQuery = [];...
0
votes
0answers
28 views

Config import failed “Duplicate entry”

I really want to like the configuration management system in Drupal. Over time, I've learned to tamp down my expectations in how it can be used to develop against a production config. On production, I'...
1
vote
0answers
66 views

Why is @? used when referring router.request_context?

In core.services.yml we have: calls: - [setContext, ['@?router.request_context']] But router.request_context is also defined in core.services.yml (and it depends on request_stack alone which doesn'...
0
votes
0answers
9 views

Accessing submitted values in Drupal commerce checkout form alter

I have added a checkbox to the Drupal commerce checkout form using hook_form_alter. I have also added a submit handler to the form but when I try to use $form_state->getValues() in the submit ...
0
votes
0answers
22 views

file_exists with 'replace' or 'use existing' not working when a variable is passed

Can somebody point out the fault in this snippet for downloading a file entity. I am trying to replace or use existing file dynamically using migrate_plus. When I give a variable it doesn't seems to ...
0
votes
0answers
16 views

Override imported data on node creation

I would like to transform some data I am getting from an RSS feed. I get a set of items and create nodes using the data I get, so far so good. However, some of the data fields contain relative URLs, ...
1
vote
1answer
34 views

Alter user's entity label method

By default the label() method of the user entity returns the username. So everywhere on the website where user references are used, the username is displayed. I need to alter this method so ...