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
2
votes
1answer
1k views

Migrate row data into drupal text formatted long multiple

I would like to import 3 different row values into a multiple text formatted long field. This is my migrate (plus) map yml: ... field_mytext_formmated: plugin: get source: - ...
0
votes
0answers
26 views

Migrate into paragraphs without parent import

If I have a data source with some values, can I process those into a paragraph attached to a node in Drupal 8 without having to run a prior migration to create the paragraphs first (and then relying ...
-1
votes
0answers
26 views

Adding custom image of search item

How we can pass the custom image on search page in d8. I have created custom_theme_preprocess_item_list__search_results function in .theme file but I am not getting node details here, I am getting ...
2
votes
1answer
48 views

How to get total number of rows on a block of a view

On hook_block_view_alter() I need to get a total number of rows that this block displays. For example, I have a view with the following block: On hook_block_view_alter() I do the appropriate checks ...
0
votes
1answer
814 views

View block pager not working

I have the following view what also is rendered as a block. This view has a mini pager with default 3 items to show. When i check configuration of the block of this view it looks like this : I ...
0
votes
1answer
182 views

How to create user programatically if not exist?

I am using this code to create user. if(user_validate_name('czxc') != ""){ $user = User::create([ 'name' =>'czxc', 'mail' => 'user@gmail....
1
vote
0answers
14 views

Customizing the checkout form

I need to fill Billing Info form with data that the user has filled in another page of my commerce site. I've made a hook_form_alter with the following weird code (with the help of kint): function ...
1
vote
1answer
62 views

composer require error: can't delete default.services.yml

using Drupal 8.8.1 composer require drupal/{{ any package }} returns Installation failed, reverting ./composer.json to its original content. [RuntimeException] ...
2
votes
1answer
35 views

How to suppress “page not found” messages in watchdog

The issue Add an option to suppress page not found watchdog messages at https://www.drupal.org/node/2836458 indicates that a setting was added to Drupal 8 to suppress page not found errors in watchdog....
1
vote
1answer
23 views

Render media url in node--page.html.twig

I have an Entity reference field field_video. It's a core Media field with a Reference type of Remote video. Because I use this field_video in my Hero section I need some additional markup here. ...
0
votes
1answer
921 views

How do I create a configuration sync folder?

I've inherited a Drupal 8 site but it has no config_HASH folder with it which means that the majority of admin paths throw an exception. How do I generate a new configuration folder based on the ...
1
vote
1answer
1k views

Create an expiration date field that auto expires

We are currently migrating a Drupal 6 site to Drupal 8. We have a view that shows a table of files uploaded through the file depot. One of the columns on the table was an Expiration Date. In Drupal 6 ...
0
votes
2answers
462 views

Change view format programmatically in Drupal 8

How to change view format progammtically using "hook_views_pre_render" in Drupal 8 or some another method ?
4
votes
2answers
153 views

What is the correct way to update my cached block when a node of a given type is saved or updated?

I have a custom module with a block plugin: SliderBlock.php class SliderBlock extends BlockBase { public function build() { $build = []; $build['#theme'] = 'slider_block'; return $...
4
votes
5answers
4k views

Get the list of available services

Is there a way to get the list of the available services in Drupal 8?
0
votes
3answers
46 views

EntityQuery for taxonomy term of specific bundle

I would like to build a query for all taxonomy terms of a specific bundle. $terms = \Drupal::entityQuery('taxonomy_term') ->condition('type','mail_template') ->execute(); This returns an ...
0
votes
1answer
63 views

Render paragraph reference field in page.html.twig

In page.html.twig I want to show a paragraph reference field which contains a left and right text_field. The name of the reference field in the node is: field_intro. That field is linked to a ...
0
votes
0answers
188 views

Get Arguments from URL for a view in which AJAx is enabled and filter are exposed

Below is my requirement I am facing an issue i want my exposed filter options to be dependent on the URL argument( i am using contextual filters), View is ajax Enabled, so i can not get the url ...
1
vote
0answers
23 views

Update field properties defined by hook_schema()

I'm probably a bit confused by documentation. Got a custom field with some properties defines in hook_schema() : /** * Some field type. * * @FieldType( * id = "field_selector", * label = @...
2
votes
1answer
841 views

How to resolve the 403 error when creating a new node via RESTful module?

I'm trying to create a new node through REST on Drupal 8 with no success and a 403 (Forbidden) error. I'm using REST UI module to enable permissions with the following config for Content resources: ...
2
votes
2answers
7k views

How to access session in twig?

I wondering how to access to session in twig ? In my Controller I have this part of code : $tempstore = \Drupal::service('user.private_tempstore')->get('mdm_user'); $tempstore->set('...
0
votes
1answer
1k views

Getting values on twig node template

I have installed ECK module in my website. Using it I have created a "report eck" entity in which I have different bundles like section, notes, etc., each containing different fields. I have my ...
1
vote
3answers
292 views

Do multi-level multi-value relationships work in a view?

In Drupal 8, I have a content type Story, with a multi-value entity reference to content type Project, which, in turn, has a multi-value reference to Team-Member, which has a single-value reference to ...
1
vote
1answer
638 views

POST JSON data denormalization error

I created rest resource plugin in a custom module and need to send some JSON data with the request, and access it in the post function. At the moment my post function does not do anything but return ...
1
vote
1answer
42 views

How to bootstrap a custom script and retrieve the session object?

I'm writing a custom script that requires a proper Drupal 8 user session to work. This is the current version: <?php use Drupal\Core\DrupalKernel; use Symfony\Component\HttpFoundation\Request; $...
0
votes
1answer
1k views

Edit CKEditor's config programmatically

I've created a Drupal 8 module that adds a custom plugin to the core's CKEditor. This plugin allows users to add tabbed content to their pages. The problem is that the plugin adds a class to the ...
0
votes
1answer
68 views

Update Symfony components

There are many posts and articles that make vague references to upgrading Symfony 3 to Symfony 4 in Drupal 8. But nothing specific. For example this one by Ryan Weaver "Symfony 4 and Drupal" I've ...
2
votes
2answers
549 views

How to make a theme hook suggestion for menu according to region?

I'm placing the same menu block in two different regions whereas different html markup for the list is needed. So analog to my previous question "How to make a theme hook suggestion for blocks ...
4
votes
1answer
762 views

Prevent dual submit on form submission

I've got a form that submits via AJAX and in the callback I need to rebuild certain parts of the page to reflect the newly submitted data. One of these parts is the form, which I need to clear all ...
0
votes
2answers
1k views

Ajax error on node form edit page

I'm trying to ajaxify part of node form. I have a hook_form_alter that adds extra ajax property to a widget of select field. The problem I'm facing is the callback method / function, which is not ...
1
vote
1answer
1k views

Entity query for distinct field

I have an entity line_item with the following fields: id uid (entity reference) product (entity reference) ... I would like to get all distinct products (product ids) for a specific user. I tried ...
0
votes
2answers
419 views

How to handle multiple URLs in Drupal migrations

I have a drupal migration that also uses migrate plus from a feed URL that can be queried. For example the migration can work for a single response from the feed at source: plugin: url ...
1
vote
1answer
416 views

Integrating external web application

I have an existing web application written in Flask. I want to create a Drupal site that integrates this existing web application, so that the existing webapp will just be a back end, and the Drupal ...
1
vote
1answer
31 views

adding new validation method using HookEventDispatcherInterface::FORM_ALTER event

I'm trying to add a new validation method for 'user_login_form' using HookEventDispatcher module and events: class MyFormEventsSubscriber implements EventSubscriberInterface { public static function ...
2
votes
1answer
2k views

How can I specify inner elements template in custom login page?

I am new in Drupal 8. I want to create a new theme to according to my HTML. What is the best practice to integrating a custom build theme to drupal engine. I have covered all sections in Drupal 8 ...
0
votes
0answers
12 views

Custom views filter plugin: cachetags invalidation does not effect option list

I described a custom views filter plugin extending InOperator. The aim is to offer a select list where the user can choose from a list of fractions of a legislature. Legislature and fractions are ...
-1
votes
0answers
23 views

Form wrapper is missing when rendering indididual components on page--node--edit.html.twig template

Form wrapper is missing when rendering indididual components on page--node--edit.html.twig template Using hook_preprocess_page we are able to create variables for form like $variables['node_form']...
0
votes
2answers
990 views

Clearing cache breaks site

I'm trying to load a production site in a dev environment using the site's codebase (core 8.3.7, contrib and custom modules and vendor folder) and the current database. After struggling a bit with it,...
2
votes
2answers
566 views

How do I overwrite a lazy service?

I'm trying to have my D8 site use Memcache for the lock service backend instead of using MySQL which is the default. In core.services.yml we have the lock defintions: lock: class: Drupal\Core\...
0
votes
0answers
28 views

Alternative for Code Per Node on Drupal 8

I'm looking for an alternative to the Code Per Node module on Drupal 8. I've tried Asset Injector and it has an issue that deletes all configuration files whenever the caches are cleared. Does anyone ...
0
votes
1answer
68 views

Cache a block by a custom entity rendered within

I struggle with getting a custom block cached correctly: we have a custom entity "Politician" For that entity we have several routes where we want to render a "politician header" with some basic ...
0
votes
1answer
677 views

REST call using curl taking to much time. Show as progress bar

I'm getting information from a source using REST. Bellow is part of my code. Basically, there's a part where I have a for loop that can take 30 to 60 seconds to complete. It works but the user doesn't ...
2
votes
2answers
2k views

Override image template for field

Can I modify core/image twig template only for specified entity.field? I want to modify img tag output only for commerce_product.images custom field but there is only 1 suggestion themes/bootstrap/...
0
votes
1answer
492 views

HTML output of whole page

I am trying to generate html output of whole page and then pass it to response array.I am doing something like this: $page = array( '#theme' => 'html', '#page_object' => new HtmlPage(...
0
votes
1answer
538 views

Admin toolbar not displaying correctly in custom theme using bootstrap

I've created custom Drupal 8 theme using bootstrap. Everything is fine except admin toolbar. Toolbar is displaying correctly in backend but in frontend is only displays the "Manage,shortcuts, admin" ...
1
vote
0answers
25 views

Hook form alter not working for node edit form

I have a content type called landing_page. If I edit an existing node in the admin /node/31/edit and I inspect the form I see id="node-landing-page-edit-form". I can't get it to work to use ...
1
vote
3answers
1k views

Should I define all my variables in the module.settings.yml file?

With the new Configuration Management System we can create a module.settings.yml file with all the variables that we will use in our module. Now just to made a test I delete all the content inside ...
2
votes
2answers
2k views

How do you rename the MACHINE NAME of a CONTENT-TYPE?

I have this content-type that i created titled: "Engineering". 1500 hundred nodes later management wants me to rename it : "Staff". I can easily rename the label but how do i rename the machine name? ...
-3
votes
0answers
39 views

How to generate a number for Drupal Commerce SKU?

I have a site on Drupal 8 and Commerce 2.16 with a marketplace (several merchants with several stores). Each merchant can fill in the SKU field with their product variations. The problem is that the ...
2
votes
5answers
3k views

How to print the latest facebook posts?

I would like to show the two latest facebook-posts on my Drupal page. I found these two modules: https://www.drupal.org/project/facebook_pull and https://github.com/mysequel/Drupal-8-Facebook-Feed-...