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
1answer
220 views

XML Sitemap for Multi-site

I have generated a XML sitemap for multi-site using a free online tool - https://www.xml-sitemaps.com. I have downloaded XML file for each site and placed sitemap.xml at the root (\src\sitemap.xml) ...
-1
votes
1answer
46 views

How to change drupal views filter from string to in opreator

/** * Implements hook_views_data(). */ function ***_views_data_alter(array &$data) { $data['content_moderation_state_field_data']['moderation_state']['filter']['id'] = '...
-1
votes
1answer
32 views

How to make my gallery as expected?

I created a content type named 'Book page with Gallery'. It has a standard 'Body' field and a 'Gallery' field which type is Image (Allowed number of values: unlimited). And by default, I get this: I ...
-1
votes
2answers
528 views

How can I use loop functionality in twig template?

I want to use a looping functionality in region.html.twig file to I can wrap elements (Blocks in this case) that outputted from {{ content }} section. Defult region.html.twig {% if content %} <...
-1
votes
2answers
485 views

Change user role programmatically using cron according to Webservice

On my site I want to set cron job that will check if user already submited form that allow them to browse website freely. I tried to catch user id (and assign a new role id) in \core\lib\Drupal\Core\...
-1
votes
1answer
130 views

How to view multiple taxonomy terms content on same page?

In Drupal 6, it was possible to view links like: taxonomy/term/1,2, taxonomy/term/1+2, taxonomy/term/2/2 or taxonomy/term/2/all which would list multiple taxonomy terms on single page (showing ...
-1
votes
1answer
440 views

Copy a content type from another site

I am the owner of 2 sites that are running Drupal 8. In Site[X] I have news nodes. In Site[Y], I want to automatically get all the news nodes that are posted on Site[X] (title, body, images etc.). ...
-1
votes
1answer
388 views

Group an aggregated view by date without time

I would like to create a view that uses aggregation on an entity to display the count and the sum by date. But it should be grouped by date only without time even the original date value has time ...
-1
votes
1answer
744 views

Add a field programmatically to taxonomy

We have a field.storage.taxonomy_term.field_name.yml file that adds the storage configuration for our custom field. The field is available to be added from the GUI to each vocabulary. The issue we ...
-1
votes
1answer
3k views

How do I pass parameters to a service?

How can parameters be passed to service? I have a class that I would like to change to a service and load other services from the container. What I don't understand is how to deal with other ...
-1
votes
2answers
872 views

get translated field doesnt find field [closed]

I have an entity which contains a field, it has content in that field , yet when I try to programmatically set something in that field, I get InvalidArgumentException: Field field_myfield is ...
-1
votes
1answer
35 views

Canvas support for IE

I am trying to add canvas support for IE 9 and below for a drupal 8 site. Can anyone suggest an approach for this? I am planning on using Modernizr and Explorer Canvas polyfill to achieve this.
-1
votes
1answer
319 views

how to set revision log message programatically in drupal 8 [closed]

I am trying to set the revision log in a custom module in drupal 8, using $media->set("revision_log","test message") and it doesnt work. This method is working for all of the other fields. why ...
-1
votes
1answer
379 views

External JSON to create/update node

I have external REST service with some info about products. This comes from some software of the company. How I can use this JSON I got to create nodes and fill in the fields in nodes? Also, I need ...
-1
votes
1answer
485 views

Drupal 8 Commerce views filter Price

I have a views with products and I want to sow products with price >= 100. I add Relationship 'Product variation'. All of my products are with one variation, so there shouldn't have duplication. When ...
-1
votes
1answer
684 views

How to Migrate from SQLite to MySQL?

I built a Drupal 8 site using SQLite. Performance is awful, so I'd like to use MySQL instead. What's the best way to go about this? A step-by-step guide would be nice, but any advice and tips are ...
-1
votes
1answer
365 views

How to set title for video embed field

I've a video embed field, where I've a youtube video link, I've printed the same on the twig. But it seems not to have the title for the iframe. How can I add one for iframe in drupal 8.
-1
votes
1answer
49 views

Custom action defined by config entity

I am currently creating a module that allows generating PDFs based on arbitrary entities (or at least nodes). Multiple templates can be defined as config entities. This part already works. I have the ...
-1
votes
1answer
73 views

Unable to display field value in node template

If I devel the contents of my custom node--view--news.html.twig template, I get this array: 'body' => array(1) 'x-default' => array(1) array(3) 'value' => string(112) "<p&...
-1
votes
2answers
404 views

How do I minify inline CSS using Twig?

Inside my html.html.twig template I've added a stylesheet inside the style elements using this. {% include directory ~ '/css/base/style.css' %} Is there a way that I can strip it for all whitespaces?...
-1
votes
1answer
679 views

Get an image field of a specific size in REST API

How can i get an specific size of an image in the REST API? I have created a view that displays as a REST export, the format of the view is: Format: Serializer Show: Entity The image field is shown ...
-1
votes
1answer
531 views

Can not debug custom twig template file with kint [duplicate]

I have created a custom template file block--myblockname.html.twig in order to edit the output of this block which is a form created in YAML form module. I am attempting to find the names of the ...
-1
votes
1answer
50 views

How to make Drupal treat the parameter passed in url as different pages?

I have used successfully implemented a HelloWorld Example module. I have modified module to query mysql database and output based on url parameters. For Example, visiting the following relative paths ...
-1
votes
3answers
2k views

Render a template file from module's controller method

I wanted to create and render a custom twig template, like it is described at Drupal.org: https://www.drupal.org/node/2640110. I have a module which is called "game" and has this route in the game....
-1
votes
1answer
562 views

Where does the theme name get stored in database?

In which table does Drupal 8 store the theme name? I'm trying to programmatically install an uninstalled theme. Obviously, there's some written logic behind the Install and set as default button. ...
-1
votes
2answers
73 views

Include a link of node with text in block body

How can I include a link to a particular page in the block body? I don't want to create a custom block.
-1
votes
1answer
268 views

How do I get the login form submitted values in hook_user_login()?

Since hook_user_login() in Drupal 8 has only 1 arg, how can I get the values submitted in the form? In other words, what is the equivalent of $edit['input]['element_name'] I would use in Drupal 7?
-1
votes
1answer
124 views

How add publish config block to a custom entity content

i have a custom entity content : Product. I am looking for a way to give the posibility to change the url of the product like this block : Block on the right. It's a screen of article content. Here ...
-1
votes
1answer
74 views

Issue for translating button value (with AJAX callback) [closed]

I think I found a issue in Drupal 8. I set my form by attaching a ajax callback on a button (not submit, an HTML button). If I translated the value of the button, the Ajax request crash without ...
-1
votes
1answer
33 views

View that shows full body - not summary or trimmed?

My use case is this: I have several articles which I wish to display, in full, on a single page, so that it be printed. I have a view that is displaying custom entities (How To), and it is displaying ...
-1
votes
2answers
607 views

Custom module to show and store the current user's email address in the database

I'm currently learning myself Drupal module development. I finished a tutorial for showing "Hello World!" in a block. And now I'm trying to show the logged in user's email and make a button to save it ...
-1
votes
1answer
240 views

how to modify the path with hook_menu_local_actions_alter

when I add the hook_local_actions_alter to my module, I can see that the node.add.page link shows up on certain pages as below. how can I modify this so that this also show up on a different path in ...
-1
votes
1answer
997 views

Why do I get this error when running update.php?

Attempting to update drupal 8.0 to 8.1, when I run update.php, I receive this error: An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /update.php/...
-1
votes
2answers
909 views

Custom navigation menu [closed]

I'm developing a new theme for my Drupal 8 site. As below picture shows, I defined a header region and when I add navigation menu to that region, I have both navigation menu and default theme ...
-1
votes
1answer
109 views

Using a rest plugin or a service how can one tell the token module the response is not cachable

I have a rest plugin which returns an array and sends a mail. When commenting the Token::replace all works fine, the token replace function creates a BubbleableMetadata object (from what I understand ...
-1
votes
2answers
802 views

How to unset $page['#attached']['html_head_link'] from head?

Help me with this question please: how to unset html_head_link from pages in my Drupal 8.0.3 site. I mean, delete this META: <link rel="delete-form" href="/node/{id}/delete" /> <link rel="...
-1
votes
1answer
28 views

How do I get the value of fields in a template?

I have created a custom template for a view called, say, "Example": views-view-fields--example--page.html.twig This works fine. I can display the title of each item in the template thus: {{ ...
-1
votes
1answer
145 views

How to add tab page in views?

I am using Drupal 8.0.0. I try to add a custom tab page (view page, using views) to my custom content type. I searched a lot, most sources related to D7 and their instructions not work in D8. It ...
-1
votes
2answers
544 views

Overriding a page content in a custom module

After looking at a bunch of modules I am still confused as to how I can take a content piece I've created (a Server), make my own custom module (servers) and do some logic so I can pass that on to a ...
-1
votes
1answer
60 views

how acces admin theme without /admin in url?

I try to have an admin theme for admin user and custom theme for user logged in without /admin/.... in the url. I create an entity content module, the routing is like that : # AnnonceEntity ...
-1
votes
1answer
1k views

Example for creating Dropbutton

I really want to implement Dropbutton in Drupal8 But I can't find any concrete example for that. $db = array( array('#type' => 'dropbutton', '#links' => array( 'a'...
-1
votes
1answer
570 views

How to retrieve specified fields using services?

Using services we can retrieve list of all nodes with different filters and we can get a specific node as well. But is there any way we can specify the fields we would like to retrieve ? Eg: api/node/...
-1
votes
2answers
35 views

How to see unpublishes content types In a view?

I have a view which displays a list of unpublished content type "Nascholingen". I use D8 + varbase + content access module In super admin all goes good. I added a new rol called "lid". Logged in ...
-1
votes
1answer
73 views

Calculating view field average

I have a custom comment type with a star rating field value. When people create a comment on a node type they can also select a rating. I need to create a way to get an average of the ratings from the ...
-1
votes
2answers
53 views

Hide some parts of a node when a countdown reaches 0?

How can I set a countdown on Drupal 8 nodes and hide some parts of node (e.g. links) when the countdown reaches 0? Edit : How can I create countdown timer for nodes?
-1
votes
1answer
240 views

Consume nodes from REST export views

I am trying to import nodes from a different domain's REST export view. I am able to get all serialized nodes from the view through Guzzle but once I try to create a node from the hal+json response I ...
-1
votes
1answer
502 views

PHP content read file location

i added the module php to enable the insertion of php content now i want to add script that read from xml file. My question is : where to add the xml file (the path on where to put my public files), ...
-1
votes
1answer
384 views

How to integrate Google Maps from address on node page?

How can I integrate Google-Map from Address on node landing page in Drupal 8? For address I am using https://www.drupal.org/project/address module.
-2
votes
2answers
74 views

How do I redirect a user to the front page after logging in? [closed]

Is there a way to redirect users to the front page after they log in, without using any additional modules other than the core modules. Right now they are redirected to their profiles.
-2
votes
1answer
217 views

How to enable or disable the “Add to Cart” button for products based on the role of the store owner?

I have Drupal 8 and Commerce 2. I created a "Merchant" and "Premium Merchant" role. By default, users who create a store have the "Merchant" role. What I am trying to do is the following. If the ...