Questions tagged [8]

Version tags should be used 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
370 views

Create taxonomy terms from content type field

I'm looking to add a taxonomy term to a vocabulary upon the creation of content type. For example I have a taxonomy vocabulary called "Widget Type". I have a content type of Product. When I create ...
1
vote
1answer
13 views

What control the placement of links realtive to the body?

I am struggling with getting the "Read more" and "Add new comment" links placed below the body on a custom node content type called "Wikitext" that has been created using ...
4
votes
1answer
932 views

Action links available options / caching

I have some action links defined in module.links.actions.yml which uses a custom "create entity" route. For entity creation I set up some restrictions and at some point the access is denied. The ...
1
vote
1answer
31 views

jquery.ui libraries-override > Incomplete library definition

I tried to remove the core jquery.ui theme.css by writing into mytheme.libraries.yml the following lines. libraries-override: core/jquery.ui: css: theme: assets/vendor/jquery.ui/...
0
votes
1answer
292 views

Is it possible to create an action with derivatives?

Is it possible to create an action in Drupal 8 and point it at a deriver class to generate them automatically? For example with Custom Publishing Options I have a ConfigurableActionBase action that ...
0
votes
1answer
545 views

Fatal error while editing and deleting menu items

Facing one issue in deleting the menu items on my Drupal 8 Site. Steps to reproduce: Add a link to main menu. Create Child terms under one link. Delete the parent term. After deleting the parent link ...
0
votes
1answer
372 views

How can I add multiple conditions for the same field taxonomy term in views query?

I make some query for views filter for nodes. Use in hook_views_query_alter. $definition = [ 'table' => 'node__field_characs', 'field' => 'field_characs_target_id', 'left_table' => '...
0
votes
1answer
497 views

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 1 no such table:

I'm getting a strange error with my Drupal site. The error is as follows: Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 1 no such table: router: SELECT name, route, ...
1
vote
1answer
1k views

How do you override the add or edit node for a particular content type

I want to format the editing or adding form for the article content type. i.e. node/add/article path and editing the same article. I copied over the node-edit-form.html.twig template from core/modules/...
2
votes
0answers
19 views

Can you rename replacement pattern tokens in views?

If you insert one or more custom text field (e.g. to include some Twig logic), latter fields will see such blocks as {{ nothing }}, {{ nothing_1 }} etc. in the replacement patterns. Can these be ...
0
votes
1answer
30 views

How to set URL for image with view method properly?

Image formatter should accept image_style and url parameters. I've got image_style working but not url. function mymodule_preprocess_views_view_field(&$variables) { // ... $variables['image'] =...
2
votes
2answers
264 views

Can users be forced to insert only plain text by default in CKEditor?

I know there is "Paste Text" button in CKEditor, and I can limit allowed HTML tags. But it's very hard to explain clients to use specific button when they insert text. As result they often ...
-2
votes
0answers
14 views

Module for payments with UPI [closed]

I am working on an e-commerce website for our own store, a small startup basically with the aim of providing value for money to the customers. We are based out of India. I am looking at integrating ...
0
votes
1answer
38 views

Composer not updating modules

I have a Drupal 8.9.16 website and when I try running composer update to update the modules, I get this output $ composer update Loading composer repositories with package information Updating ...
-1
votes
1answer
21 views

Sum the grouped results in the template

I have an aggregated view result grouped by taxonomy terms and shown like the following. TaxonomyTerm1 1 1 TaxonomyTerm2 1 TaxonomyTerm3 1 1 1 I want the result to be added and shown like the ...
0
votes
1answer
23 views

Why does my shopping cart item not have a label?

I'm working on D8 site with Drupal Commerce. I have to create a dynamic product variation and add it to cart for the user checkout. The problem I have, is when you land on the cart page, the line item ...
1
vote
1answer
1k views

Node view mode in page template suggestions

I would like page template suggestions when a node is using a custom view mode. I think this would happen in hook_theme_suggestions_page_alter(). I have already been able to get page-level template ...
3
votes
2answers
88 views

Migrating content from live to development environment with Docker

I'm trying to create a localhost development server with a dockerized drupal 8 environment and need to transfer the content from the live site to localhost. I have followed the instructions for ...
1
vote
1answer
393 views

View filtering, Relationship Vs Contextual filter

I used contextual filters before and I know they are just like the normal filters but more dynamic, now I have this view "Sidebar Product advert block" that needs to show the product advert ( Similar ...
0
votes
1answer
685 views

Create order : how to set price?

In my module, on a cron_job function I need to create an order with specific order_item price. Here is my code : switch ($role[1]) { case 'biocoop': $role_price = $...
2
votes
0answers
13 views

Correctly configure the JavaScript tools

I am trying to configure eslint for Drupal in PHPStorm, and it's really confusing. For example, I have installed the node dependencies that comes in the web/core/package.json file. In PHPStorm, in the ...
1
vote
0answers
27 views

How to programmatically add a paragraph item to a user account?

I already added the Check in/out History field to the user account, which has the check-in date and 'check-out date* fields. How can I programmatically add new items to Check in/out History? I need to ...
1
vote
2answers
7k views

Drupal::request()->request->all() returns an empty array

I have a custom controller that expects POST data. I had it working fine in 8.1.0 retrieving the data using \Drupal::request()->request->all() and \Drupal::request()->request->get($myvar). ...
0
votes
1answer
963 views

Adding custom data to the node object

I have created a content type called providers and when editting said content types users can fill in extra information related to the content. I have included said form fields using hook_form_alter, ...
3
votes
2answers
2k views

How to create a Class that I can reuse in multiple modules?

I would like to create a class that has a set of methods that I want to reuse across the site in either mytheme.theme or secondmodule.module files. How would I create this class and class methods so ...
4
votes
2answers
931 views

How do I remove JOIN in hook_views_query_alter()?

I have a view with two filters (A + B). Filter B should only be included in the query, if a specific value in filter A is set (like a "conditional filter"). So I tried to remove the where condition ...
0
votes
1answer
21 views

Why do I get “An invalid selection has been identified.” from the form my code creates?

I am using the following code for a form. public function buildForm(array $form, FormStateInterface $form_state) { $region_options = static::getFirstDropdownOptions(); $form['vvv_region'] = [ '...
2
votes
1answer
253 views

#ajax on a managed_file custom form field is not working

I have a custom Drupal 8 form using a managed_file field with an #ajax callback but the ajax callback is never called (example below). I assume that it's because the managed file field type is already ...
1
vote
1answer
2k views

How to call preprocess functions from my custom module

I have created a custom module that declares a custom image formatter. Now I need to call the Core image module preprocess function 'template_preprocess_image_formatter'. How would I do that? I tried ...
1
vote
1answer
515 views

Create file through services

I've been trying to create and update users and their pictures through REST calls using the services module. So far, I've got creating and updating users to work, but creating files to set their ...
0
votes
1answer
146 views

After moving to a new server, one of the sites has no CSS loaded

I moved 2 sites from a shared server to a VPS. One of the sites works fine with a custom theme, but the second doesn't load the Bartik CSS styles. Both sites has been moved via the user root and ...
1
vote
2answers
203 views

Does moving to PHP 7 require any system change to be done with Drush or from the GUI?

After moving a Drupal site from PHP 5.6 to 7.13, is it better to change something from the GUI or from Drush?
2
votes
3answers
927 views

Why a unnamed <div> is added to a specific region?

I have 2 blocks in a region (headline). Drupal 8 seems to add these 2 blocks into an unnamed div and thus their display:flex CSS layout is cancelled. (You can't scatter 2 container items if these are ...
9
votes
5answers
2k views

“Source database does not contain a recognizable Drupal version.”

I have installed two Drupal sites in my local Ubuntu desktop 15.10 Apache2 (2.4.12) environment: One is a fresh install of Drupal 8 and The second is a copy of an existing working site built with ...
1
vote
1answer
137 views

Is it a bug? blog-View read more button reference to home page

I manually created a blog which is a view page with 3 fields: image, title, and body. The body field has a Read more link. Yet, instead of pointing to the specific node listed in the blog, it lists to ...
-2
votes
1answer
38 views

Full automation for upgrading everything

I have a Drupal 8.5.x site with the Redirect and the Metatag modules installed. I want to fully automate the process of upgrading Drupal including Drupal core, the translations, the themes, and any ...
1
vote
1answer
129 views

Numbering table rows

Views are normally formatted as unformatted list. I would format a view as HTML list, and choose between <ul> or <ol> markup. Since I use the DraggableViews module, I need to format the ...
2
votes
2answers
4k views

How can I update core. all the modules, and the themes from the command line?

On a LAMP environment, I have a Drupal 8.5.6 site which is nearly all-core with the Bartik theme and a few stable contributed modules. Nothing is customized and I have daily backups so I don't "...
-2
votes
1answer
363 views

Save contact form data in the database instead of transferring it to an email account

So far I had to set up email DNS records and an email server or, alternatively, an email proxy by an email account to transfer emails from a CMS to my email account. Email DNS records and email ...
0
votes
1answer
114 views

Is using SQL table prefixes necessary?

During an upgrade, there is a setting for the table prefixes to use for the database table. Is it a must to use table prefixes? What does using that setting help with?
-2
votes
0answers
17 views

Show a block only for a limited period of time after the page has been served [closed]

How could I show a view or block only for 10 seconds after the page has been served? The ideal would be to show it when users reach the end of the page, but it is a view with infinite scroll. If I do ...
0
votes
1answer
364 views

Remove entities programmatically from view results before pager is generated

I want to remove certain entities from the view results (Views core module), before the view's pager is generated. By now I am doing it in hook_views_post_execute(). The problem here is, that the ...
0
votes
1answer
16 views

Proper usage of config_split

I am trying to use config_split so we can ignore/disable some modules/configurations on our dev environments, and we don't want them to carry over to our production environments. I think I am setting ...
3
votes
1answer
490 views

Is it possible to override/replace an event subscriber

I would like to replace an event subscriber. Is there any way that I can write my class implementing EventSubscriberInterface which would replace another existing event subscriber instead of being ...
0
votes
1answer
17 views

Cannot update Group module with composer

We are using the Group module on our D8 site. We use composer to manage our modules and dependencies. I am somewhat of a composer novice, so it's possible that the solution is right in front of me, ...
2
votes
1answer
45 views

Is the following code secure when saving data to database?

I have a form that I want to save to database. Do you consider the following code safe? I get the value directly from the $form_state and pass it into query. My understanding, it query will do the ...
2
votes
1answer
20 views

Modify sorting criteria using views_query_alter

I have a view for the content type events with fields event_name, description, summary, event_start_date, etc. What my requirement is: Sort the events in ascending order of event_date equal or ...
0
votes
0answers
47 views

How do I set an item definition class for a configuration field?

I am not able to set an item definition class for a configuration field. I tried implementing hook_entity_bundle_field_info_alter() , but it doesn't work. function hook_entity_bundle_field_info_alter(&...
6
votes
1answer
514 views

Set SameSite=strict for session cookies

I'm trying to figure out how to set the SameSite cookie attribute for Drupal 8 session cookies, but I can't find a solution. I thought SessionConfiguration might give me enough options, but it seems ...
1
vote
1answer
367 views

Getting a formatted address component in another field's template

I need to pull the administrative area component from an Address field and place the full text of it it in the template of another field on the content type. I've managed to accomplish this with the ...

1
2 3 4 5
315