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.

Filter by
Sorted by
Tagged with
0
votes
1answer
24 views

Render array only working with numeric keys

I have a FieldFormatter that outputs a DIV, a table and attaches a JS library. Normally in Drupal (e.g. Form API) it's possible to label the render array keys however you like? Weirdly in this case, ...
0
votes
0answers
25 views

How to change background colour of webform?

I'm finishing a website that someone else started and there are a few things I can't figure out. It's a Drupal 8 installation and I have administrator permissions, but I've tried every setting I can ...
0
votes
0answers
11 views

How to unpublish a special paragraph type when user loose a special user role [closed]

Hi I would like to achieve following on my website for disabled people: When a user gets a special user role, then he should be able to place some special paragraph types in a node field (in addition ...
0
votes
0answers
11 views

How to allow access to Webform Submission Grid results to Role

Giving admin privileges to sales dept seems bad. The Webform Customized submissions is super! However I am unable to create a link for my Sales manager to view the same data without giving admin ...
0
votes
0answers
10 views

Media field format 'rendered entity' for video and 'thumbnail' for image (with image style)

I have a custom block type (call to action) where the editor can insert an image or video. In the 'manage display' of the field_media I can set the format to Rendered entity. Both the image or video ...
1
vote
1answer
40 views

For each image uploaded in a node: get the url

I'm begining with Drupal 8 and I want to get the url of the photos in the content I create to display them. The context is : a photograph upload pictures for a customer. This customer can see it on a ...
0
votes
1answer
19 views

Embedded View Form Ajax not working

I have a an embedded view display (type = embed) with an exposed form and pager. Ajax is enabled for the display. The pager reloads the display via ajax, however the form does not. I'm all but certain ...
0
votes
2answers
32 views

Migration with unique index across multiple fields

It is the first time I'm using the migrate module and I want to import some nodes from a JSON file and to specify a unique key that has two distinct fields. I.e so that the row is not imported or it's ...
1
vote
2answers
140 views

Field formatter module throws cannot declare class error

I am trying to write a custom module, which defines a field formatter plugin, but when I visit the Manage display page, I get this error: Fatal error: Cannot declare class Drupal\my_formatter\...
0
votes
1answer
17 views

Embed a single field from an existing content in ckeditor

I managed to embed the full content or teaser using Entity Embed module in Drupal 8 but, is it possible to embed a single field which contains text or html without coding
1
vote
0answers
22 views

Kernel Test: How can I get an overridden config value from settings.php

In my settings.php file i have a custom configuration that is changed on a per site basis, e.g. $config['brand_id'] = 1 I have a function that will fetch that value, and I am trying to setup a kernel ...
0
votes
1answer
16 views

Create a view to list all contents that uses media through any entity reference field

I know it is possible to create view to list all content that is using media through a particular entity reference field. Is it possible to create a view to to list all content that is using media ...
-1
votes
0answers
20 views

how to get markup of /node/add/{content_type} in another custom controller

I have a content type Post and I created a custom module with a controller /create-post and how do I get the markup of /node/add/post in current controller. how do I get otherPageHtml Basically, I am ...
0
votes
0answers
15 views

how to call Manage From Display for a content type in page controller [duplicate]

I have created a Form Mode and configured the Form Display as below image Now, how do I call this form display in custom module controller.
0
votes
0answers
16 views

YouTube media remote video - thumbnails in wrong aspect ratio have letterbox/black bars [duplicate]

I'm using the media module in D8 (core 8.7.7) I can add YouTube videos, however although the videos themselves (and the thumbnails on youtube.com) are widescreen, Drupal is saving 480x360 4:3 images ...
0
votes
0answers
11 views

WebDriverTestBase generated HTML output is missing required libraries

I have a failing functional JS test and it looks like required assets are not being attached to the page. The block I am testing has #attached set with the right information, as the implementation ...
0
votes
0answers
14 views

WebDriverTestBase can't place/see block configuration in an AJAX text

I am writing a functional test that checks the output of a page when a user has a specific cookie. Based on that cookie, I have a block powered by Ajax Block that injects block content personalized ...
1
vote
1answer
38 views

How can I get translated path aliases for a custom language switcher?

The Drupal 8 standard "Language switcher" dropdown does not give me what I need. What I need is to break everything apart into groups and subgroups, in a div, and have custom text for each Language, ...
-1
votes
0answers
20 views

How to create bootstrap barrio modal with form?

I am using Bootstrap Barrio theme in Drupal 8. How do I create a Modal (only Bootstrap modal not Drupal's Administrative modal) that has Form and when submits the form it store it a Content.
0
votes
0answers
15 views

How to decode Chinese characters in while exporting to CSV from views data export module?

I have used Views Data Export module for CSV exporting in views. It works fine but its not able to decode non-latin languages. I didn't find any configuration also in views data export settings. Only ...
0
votes
0answers
14 views

Separate page (non-administrative) for adding content for Non-Admin User with few fields

I have a Content type Product with fields Title Tags Picture (File) Status (Active, InActive) (For Administrator purpose) I want the other type of Users to add Product content without using ...
0
votes
0answers
28 views

How to specify or alter which user or role is referenced when an entity gets programmatically rendered?

I have a situation where I need to programmatically render a node entity. I need to get the version of the node that anonymous users will see, but the render will be triggered by an authenticated user....
4
votes
1answer
44 views

Drush or Drupal console command to list modules with security updates?

Is there a command for Drupal 8.x that shows available updates? I added forms_steps 1.1 that has and SA and a security update required in the Web UI which is saying to update to 1.2 I tried drush pm:...
1
vote
1answer
27 views

Can we output individual form items within a Layout?

We are using Layouts (via mytheme.layouts.yml) to create regions for our Node Edit forms. This looks something like... edit_nodelayout: label: 'Edit Node Layout' category: edit path: templates/...
0
votes
1answer
17 views

how to stop a view from executing within a views hook

I am using custom code with a views pre_execute and i want the view to return an empty set if certain conditions are met , or not to return the view at all. how can i do this ? this is what i tried. ...
0
votes
0answers
10 views

#states property in field cause multiple values not work in form with paragraphs

Hi i have an issue with form How do i fix that? I have created custom Entity and few bundles in bundle i'm using reference fields one of them is from Paragraphs with multiple values. i needed ...
0
votes
0answers
16 views

How can we set entity refrence view in #selection_settings programtically?

I want to attach "game_name_entity_reference" view to autocomplete field in programmatically. Can we do this by #selection_settings attribute? or any other way?
0
votes
0answers
21 views

Mail body best practices

I've made several modules that send out emails. For example a form submit triggering the sending of an email. What would be the best practice for the mail body? It needs to be translatable. Create a ...
0
votes
1answer
38 views

Creating a Paragraph type programmatically

I have a custom module that is installed on a number of sites. In an hook_update_n function I would like to add a completely new Paragraph type (not actual instance of a Paragraph) to every site, ...
0
votes
0answers
8 views

Display Suite Extra options not showing up

I installed and activated the "Display Suite Extra" module. But the menu point "Custom CSS classes" under "Manage display" of any content type is missing. What else do I need to activate the Display ...
1
vote
0answers
20 views

How to create a query nodes, that queries content with more than one comment?

Consider this example: $query = \Drupal::entityTypeManager()->getStorage('node')->getQuery(); $nids = $query->condition('type', 'question') ->condition('status', 1) ->...
-2
votes
0answers
14 views

ECK field for multiple languages

I have site with multiple languages I have created a field in ECK link_title which shouldn't work for different language eg: I am trying to store title in two different languages eg EN/JA.
0
votes
0answers
20 views

getting the translated version of current url token

In D8, with the usual translation modules enabled, I have a custom pop-up to change language on our site. Currently, it contains a link and text, like this: <p><a href="/en-us[current-page:...
0
votes
1answer
70 views

Load a block contents dynamically / via AJAX?

I need to have a custom block on the page (will be sitewide) that has two states - one for when a cookie is present and has a certain value, and the other for when that cookie is not there or the ...
0
votes
2answers
46 views

How to detect the ip address of the device itself?

Using PHP and Drupal 8, I am trying to detect the ip address of the device itself and not the ip address of the router where the device is connected through the internet. $DeviceIP = \Drupal::request(...
0
votes
0answers
14 views

Setting a Default Value for Exposed View Filter

I have a view with a numeric field. I'm using Better Exposed Filters and the jQuery UI slider that comes with it. The value is filtering for "less than or equal." The default value automatically ...
0
votes
0answers
26 views

Phar not working in Drupal 8

If I try to use a simple Phar call in my controller: $tar = new \PharData('/path/to/myTar.tar'); I get the error: "Unexpected file extension" This is because Drupal Security checks to see if the ...
0
votes
0answers
27 views

HTTP exception not giving a Json Response in custom module file

I am using the Drupal REST module. I have a custom module file I have created and it has a hook below function magri_rest_user_presave($account) { if (isset($account->field_region->value)) {...
2
votes
1answer
37 views

Is accessing the current node from multiple block plugins on a single page costly from a performance perspective?

I use a combination of Block plugins and panels to populate the layouts of the display modes of various content types. Here's an example: class MyBlockPlugin extends BlockBase { /** * {@...
0
votes
1answer
24 views

Limit access to node detail page only without using hook_entity_access [on hold]

I'm trying to implement a "simple" access control solution where access to the full detail page of a node is restricted only. Any other references to the node should be unrestricted: Views listings ...
0
votes
0answers
19 views

How can I have facet items set to disabled instead of hidden if no results?

We currently have a Views page with Search API and Elastic Search. There are 3 facets available: Category (radio, single selection) Range (checkbox, multiple select allowed) Type (checkbox, ...
0
votes
1answer
34 views

What's the best approach to create content for users not using an admin theme?

I created a content type : Post and has below fields title media (file) tags (taxonomy) status (only for admin) field_1 (only for admin) field_2 (only for admin) Basically, in Drupal 8 we can set ...
-1
votes
0answers
11 views

how to add “addtoany” share icons on search result of a node

I want to display addtoany share icons on search result of a node. And I'm customizing search template search-result.html.twig and how specically tell addtoany to display in search results. I added a ...
0
votes
0answers
9 views

How to implement autoincrement field using inline_entity_form module in field collection?

I have 1 field collection in that added the entity reference field and set widget "Inline entity form-complex". Now i want to show auto increment number in "Game Code" text field. I have tried with ...
0
votes
1answer
20 views

Rewrite results output creates 2 links for one for one rewritten custom text field

I am using replacement patterns to rewrite the results of my content title field with the manufacturers name in front of the title. I am using the following custom text within the title field to ...
0
votes
1answer
27 views

How to display a field of the parent store in my module?

I have a Drupal 8.7 site with the Drupal Commerce 2.14 module. I created a marketplace (several merchants on the same site). In the store type, I created a "Text (formatted, long)" field with the ...
0
votes
0answers
26 views

Filter a view based on current user's roles

I'm using a view to populate an Entity reference field on a profile. (So it's a view of "Entity Reference" display type.) I want to filter this view to show (and allow users to select) only: ...
1
vote
2answers
14 views

How to detect Panelizer use in template_preprocess_html()?

In Drupal 7, you could look for $node->panelizer or use page_manager_get_current_page() to check if the current page uses a panelizer layout. How do you do that in Drupal 8? I'm trying to add a ...
0
votes
1answer
27 views

Where do I put configuration files for testing?

Hopefully, this will be a simple question. I am writing a kernel test for a class, called FooConfig, that reads from a configuration file. For the purpose of facilitating this test, I need a ...
0
votes
1answer
23 views

How to display content for a Taxonomy Vocabulary?

I am using Drupal 8. I have a Vocabulary called Fruit which contains terms: Apple Banana Orange I can go to page for term Apple and I can find all the content which was tagged with apple there. I ...