We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [8]

Version tag to tag issues specifically related to Drupal 8.x. Please note that 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
2 views

Trying to make mass webforms more efficient

I have an application that we're migrating in to Drupal 8. Its a system that allows the creation of forms for our clients and then allows the submissions by their clients. We create base forms with ...
0
votes
1answer
603 views

How to print a taxonomy term's field value alongside a Views grouping header?

In Drupal 8.4.4 I have a "Living Things" taxonomy vocabulary. One field on the terms in the vocabulary is "Most Common Name", with machine name field_most_common_name. On my "Animalia" term its value ...
0
votes
1answer
25 views

How to use service container correcly?

I want to use service container inside my class so I have this this: class SomeController extends ControllerBase { protected $entityTypeManager; protected $requestStack; public function ...
0
votes
1answer
455 views

Get Checkbox Value From Another Form

How do i get the value of a checkbox from another form/page and how do i make it so if the checkbox is enabled, it'll allow a button to be visible? checkbox in SettingsForm.php: $form['#tree'] = ...
0
votes
1answer
22 views

How to add HTML5 attribute “autocomplete” to form fields?

According to an accessibility test, I have to add the HTML5 attribute "autocomplete" an the proper tags to all form fields on my website where the user fills in his/ her personal data. E.g. "Your E-...
0
votes
2answers
356 views

Use twig to style a specific block (unformated list)

I have a block showing a unformated List of fields. Now I would like to use twig to style that block. I am able to use block--views-block--blockname-block.html.twig to do the outer styling. But I ...
0
votes
0answers
16 views

Disable cache a custom block for anonymous user

I have a custom block, it displays in every pages with dynamic data calculates in every refresh, How can I disable cache for this block for anonymous users? I try with: public function build() { ...
0
votes
0answers
15 views

DDEV php/twig error “Unknown ”link_attributes“ filter.”

So I'm trying to setup a local environment with ddev for the first time. I got it running, cloned my live files with git and imported my DB. Site ain't working and got this in the log : "PHP message: ...
24
votes
8answers
7k views

How do I migrate block content from a dev to a production site?

I've finally started looking at Drupal 8 seriously and I'm particularly interested in the configuration management. I've come across something that could be a little bit problematic and that's ...
0
votes
0answers
46 views
+50

How to enable click-sorting for views table display based on Search API index?

I'm trying to create a view with table display based on Search API (database search) index, with column-sorting (column set as Sortable in the display settings). However, this option isn't available ...
2
votes
0answers
48 views

Dealing with installed modules/extensions in composer packages removed from composer.json [duplicate]

I had brought up a similar question on StackOverflow, but it hasn't gotten much traction because of a lack of understanding of Drupal, I think. The issue we are experiencing happens when a developer ...
1
vote
1answer
20 views

Job queue – dealing with stuck records

I have a cron job that gets stuck because I have a loop claiming items from the queue that ends on numberOfItems() == 0, which never happens because one of the queue items is stuck and cannot be ...
2
votes
1answer
18 views

drush migrate-upgrade “[debug] key_value table not found. Database may be empty.”

I am trying to migrate a D7 site to D8 following the steps found here . Once I can manage it and make sure I have all the PHP components, Drupal modules and etc. I have 4 sites to update, and one ...
0
votes
0answers
23 views

webform ajax callback response not updating text, is something missing?

The code below works inside hook_form_alter. The description and price update from database as desired when in form_alter. I moved the code to the callback and now it wont return/update the values. ...
0
votes
1answer
16 views

Change views exposed filter value only on page reload

Is there a clean way to alter a View exposed filter field, but only on page reload and not each time you submit the exposed filters form ? Example I have a View with exposed filters. When a user is ...
1
vote
0answers
32 views

Entity browser or Media Library for PDF uploads?

Client has a custom Content Type for for downloadable PDF document detail pages, which contains an entity reference to the File media type. They want Full and Teaser view modes to display a thumbnail ...
0
votes
2answers
20 views

How do i dynamically import changing feed links within a feed

I am uncertain how to approach this. I have a feed with housing cases that is changing constantly. The feed consists of a case number and a feed link to that particular house. Each house has so much ...
0
votes
1answer
29 views

Alter block form

I'm using the contrib module contact block and I would like to edit the block form settings. By default, there is a textfield (title) and the "Display title" checkbox, I need to hide those fields by ...
1
vote
1answer
163 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
21 views

How do I add more pages to views pagination on mobile?

I'm using Open Social and I want to add more pages to the paginationon mobile phones. One of my views has 11 pages of users and on mobile the pagination is as the following example (<< = ...
1
vote
1answer
23 views

Bootstrap simple carousel: how to display it on front-end?

I've installed Bootstrap simple carousel module and I know how to add/edit slides. But I didn't find anywhere instructions on how to display them on the front-end. Module didn't create any new block, ...
0
votes
0answers
38 views

How to customize the front page for each user of specific role?

For my Drupal 8 website I would like to display for the user after login some page /related-content/% where % is a contextual filter and needs to be replaced by the current user id. I have downloaded ...
0
votes
0answers
13 views

How to normalize / resolve membership ID to all account UID per group_content

I'm trying to add the owner's membership to every GroupContent. By default ownership is only identified by the Account ID. It seems a Normalizer and/or custom resolver is necessary. Beyond my ...
0
votes
0answers
43 views

how to convert a timestamp into a date format in a custom module [duplicate]

I created a custom module and printed this outcome in .csv. Name,Event,Email,Timestamp Ea Iustum Jus,Fifa,example@asdf.wer,1573924224 How do I convert the timestamp in a date format? I tried with $...
0
votes
0answers
37 views

How do I pull a value from a Paragraph field and put it in a template? [duplicate]

I would like to pull a value from a field I have in Paragraphs. I have a content type called "Landing Pages" (landing_pages) I have a paragraph type called "Landing Page" (landing_page) The field ...
0
votes
0answers
28 views

CKEditor was grayed out after adding Content Security Policy [on hold]

I have a Drupal 8 website. I added CSP to the website header in .htaccess file. The code is, Header set Content-Security-Policy "default-src 'self'; *.cloudflare.com; www.google-analytics.com" After ...
0
votes
1answer
33 views

How to create paragraph of particular type using JSONAPI?

I am able to GET the data using endpoint "site_url/jsonapi/paragraph/text". But I am not able to create a new paragraph of type text. Its always giving me error "403 forbidden". I have tried all ...
0
votes
0answers
58 views

How to load twig file in jquery? [on hold]

In controller, there is a function call displaypage() which return below param return [ '#theme' => 'page_test', '#attached' => [ 'drupalSettings' => [ 'test' => [ '...
0
votes
1answer
363 views

How do I use Hook_update_N to update an FieldConfigStorage?

function some_config_update_8101(){ if ( !FieldConfig::load('image_byline') ){ $config_path = drupal_get_path('module', 'some_config') . '/config/install/field.field.node.main_image....
0
votes
1answer
334 views

How to display the language settings (Site language field) on the user registration form in Drupal 8?

I'm trying to display the user's language settings field on the registration page, but no success so far. I've tried using a template (form--user-register-form.html.twig). This works for other fields,...
0
votes
1answer
396 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, ...
2
votes
1answer
492 views

Upload a file by Ajax without submitting the form

I want to upload a file by Ajax (without submitting the form) than process in backend, and clear the field to allow to add another file. Is it possible with Drupal 8? Can anyone provide an example? I ...
3
votes
1answer
157 views

Disabling Page Cache for Redirect Response

I've implemented a conditional redirect on my site via an event subscriber and returning a redirect response. It's working but, I believe due to the page_cache module is getting cached for anonymous ...
-1
votes
3answers
48 views

How do I programmatically create a webform from a newly created node?

This is the code I am using. function walk_handler_entity_presave(EntityInterface $entity) { if (method_exists($entity, 'getType') && $entity->getType() === 'walk') { $elements = []; ...
0
votes
1answer
531 views

Request referer gets cached

I need to grab referer and save it for the first time (I save it to sessions) and when the user gets to a specific page forward it. My problem is that after opening page with the same referer few ...
5
votes
2answers
6k views

How do I programmatically create users?

I need to create users in code specifying password, email and other fields' values. How can I achieve this?
0
votes
2answers
337 views

How to display the pager on top and bottom of a custom search results page?

I have used the core Search Page functionality in Drupal 8 to built a search engine on my site. The pager is displayed at the bottom by default. How can i display the pager on the top also? Note: I ...
0
votes
1answer
54 views

Create new node and assign it to user after they have been registered

I have one user role on d8 and have few additional fields on user account so when people are registering they can leave additional data. What I would like to achieve is that when user registers - new ...
4
votes
2answers
1k views

How can I convert the code that used drupal_get_http_header() to check if Drupal returned a 403 or 404 error?

I have a module that in hook_preprocess() checks with drupal_get_http_header() whether Drupal is returning a 403 or 404 error, but in Drupal 8 that function is deprecated, since header handling is ...
2
votes
1answer
827 views

TypeError on “drush config-export”

I've been receiving the following error message when trying to do a drush config-export command. However, I am able to successfully do the configuration export from the Drupal admin page (admin/config/...
0
votes
1answer
520 views

How to get the drush command defined in migrate tools to work?

I have a D8 site since some months. Today I realised that I needed drush in order to migrate some contents (using the migrate tools module). Composer was not installed, so I installed it. Then I ...
0
votes
0answers
27 views

Cannot update modules, get a 403 error

An AJAX HTTP error occurred. HTTP Result Code: 403 Debugging information follows. Path: /core/authorize.php/core/authorize.php?batch=1&id=31&op=do_nojs&op=do StatusText: Forbidden ...
7
votes
1answer
1k views

How do I enable and use a view mode for a product type?

In default commerce2 (drupal 8) I want to add second product-type view mode, to show in views - like teaser version, including add-to-cart btn with variations. I have additional field in Product type ...
0
votes
0answers
19 views

Migrate one to many relationship

My D8 site has two entities: resource author The resource entity has a field_authors entity reference field with unlimited cardinality. My source data is coming from 3 tables resource author ...
0
votes
0answers
30 views

Drag and drop between categories functionality for users [on hold]

I have a content type where user selects a certain status and data is sorted for each status through views. I want to build a drop and drop functionality where users could move the box of each content ...
1
vote
2answers
77 views

What is the correct way to use a Symfony bundle?

I want to use https://github.com/KnpLabs/KnpSnappyBundle in a Drupal 8 project. How do I correctly use it?
3
votes
2answers
540 views

Overriding permissions selectively via settings.php/settings.local.php

The use case is a development module that you would only have installed on a local environment. My thought was to use $config in settings.php to do this: $config['user.role.anonymous']['permissions']...
0
votes
1answer
10 views

Fill the “Unpublish on” date field of the Scheduler module depending on list field

I have a content type, where I want to give the user only three possibilities to unpublish content: in 1, 3 or 6 months. For the selection of the three options I use a list field. How can I transfer ...
0
votes
1answer
343 views

Change “Custom Text” field value

In Drupal 8, I created a view containing a Custom Text field. I want to alter/change its content for each row I get after running some code. I tried implementing hook_views_pre_render() and ...
0
votes
0answers
29 views

Displaying translated nodes in views [duplicate]

I am facing a challenge in displaying views for translated contents. Consider a general scenario: Multilingual site with English(site default), German languages. A content type Article has 100 ...