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
0answers
46 views

Programmatically creating paragraphs is extremely slow

I am adding paragraphs from xml file programmatically but it is extremely slow. for example I'm basically creating paragraphs like this: $row = ['field_title' => 'title', 'field_id' => 'id' .......
0
votes
1answer
17 views

How to limit the words in search api autocomplete suggestion?

I have a requirement to limit the words to show up in row of autocomplete suggestion. Now its showing titles but problem is titles are too long and suggestions are covering entire width of the screen. ...
0
votes
1answer
26 views

How to save the webform data to custom table?

I designed a student registration form using webforms module. My requirement is to save data from the form to table student. How can i achieve this? Is there anyway to mention this in configuration ...
0
votes
2answers
351 views

How can I fix this update issue?

I have updated a Drupal site from 8.5.3 to 8.6.3 and got the following error related to the webform module. Can anyone help me fix this? webform module Update #8108 Failed: Drupal\Core\...
0
votes
1answer
31 views

How can I rebuild my installation after attempting to manually update D8 core using D7 instructions?

After following the manual update instructions linked from the download page for Drupal 8.3.4, I got a "The website encountered an unexpected error. Please try again later." This is when I noticed ...
2
votes
2answers
3k views

How do I install Drupal Console to my project with Composer?

I am running my Drupal 8 project under Acquia Dev Desktop 2 and just got Composer installed. How can I add the Drupal Console to my project?
0
votes
1answer
25 views

CKEditor add custom class to table

I want to add a class to a table inserted in CKEditor. I have tried to add a custom style using the styles dropdown and add this line, table.my-custom-class|Table, but when clicking on the table the ...
1
vote
1answer
84 views

Updating without Composer

I've previously used Drush to update my Drupal-installations. They are installed without using Composer, and currently on version 8.7.3. However, when I try to use Drush (drush v8.1.15, using drush up)...
1
vote
1answer
724 views

Redirect to Different URl on validation errors in form builder

I am using drupal 8 fapi and i have user case as below I have a form on https://example.com/landing-page and I submit the form and there are validation errors .the page should reload as https://...
1
vote
3answers
63 views

Set label of $entity programmatically in a custom form

I need to change the label of a custom content type programmatically. I've looked around but I couldn't find a solution. This is my custom form: class GroupContentForm extends ContentEntityForm { /...
0
votes
1answer
734 views

Add uid to existing menu link

I have a custom menu MyMenu and I have four menu items. What I want to do is to add the current uid as a parameter at the end of the link. In D7 I could use menu_tokens module which is not available ...
1
vote
1answer
18 views

Token to get the last component of [node:url]

I'm using [node:url:relative] but my path has multiple parts /content-type/node-title . I would like to get only the node-title part. Alternatively, a token that give me the node title transliterate ...
4
votes
1answer
710 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 ...
-1
votes
0answers
39 views

How can I populate an image field using JSON:API?

I tried to upload image files into an image filed using the JSON API. I am following the instruction in the page: https://www.drupal.org/node/3024331 However, I get an error (response 500). Below is ...
1
vote
1answer
23 views

Webform page wizard and submission data - no reference to which page the element was on

I am creating a multi-page webform questionaire using the Page wizard. I have also created a custom handler so I can manipulate the data from the form when completed. My issue is that when using $...
2
votes
1answer
388 views

How to extend a specific node type form?

I am searching a way to overwrite the NodeForm to get a class per bundle. Actually EntityForm manages the form for all entities. NodeForm extends it and manages the forms for all nodes. I wrote a ...
1
vote
1answer
920 views

How to access an entity loaded out of the cache

I am working on a Drupal 8 modules which should push a http response header based on a value stored in an entity or a list of entities. The module was originally done for D7 and now is in porting up ...
0
votes
2answers
663 views

How do I theme the contact form?

I am trying to create a contact form for users with username, email, message, and submission button, but I want to customize the structure of the form. Where do I get the structure of the form to ...
0
votes
2answers
941 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 ...
2
votes
1answer
41 views

Migrate nodes with special characters in title

Given a source's title like This "cool" & "neat" article's title has HTML entities , is creating a title of This "cool" & "neat" article's ...
0
votes
1answer
427 views

User registration without email address OR registration with pseudo-email address

I am programmatically creating users for the roles Parent (Adult) & Child (minor). During registration, minors (Children) typically will not have email addresses but Drupal user registration ...
2
votes
2answers
440 views

Displaying all values of a List (text) field, whether checked or unchecked

[Drupal 8] I have a List (text) field that allows multiple values, displayed as a check box list when editing. But when viewing the node, only the checked values are displayed. How can I display all ...
0
votes
0answers
32 views

503 Service Unavailable error in all pages except added to my route file

I have a D8 web with some views and pages. If I log in with administrator user, all works good. If I log in with a normal user, I get 503 service unavailable error after some seconds of load. It ...
0
votes
1answer
755 views

How do I add custom contextual links in a block?

I want to add more contextual links (e.g. "Edit Block") to my block apart from the existing "Configure Block". How can I achieve this?
0
votes
0answers
13 views

How to alter search api autocomplete to exact match?

I have installed search api autocomplete module. I have configured it also but the requirement is to it should search only 'starts with word'. now the result is searching if a word present in mid of a ...
0
votes
2answers
610 views

How to change payment state programmatically?

I had created a custom module to update order state and payment state. In my controller I used the following code to change the order state of order. $order = \Drupal\commerce_order\Entity\Order::...
1
vote
0answers
27 views

Rendering a multipage form from single function

Is it possible to create a multipage form from a single function? I looked at the MultistepForm.php script in the example module which uses a separate function to render each page of the multi-step ...
4
votes
1answer
2k views

View for Taxonomy terms?

How can I output nodes which linked with taxonomy term through a view? How can I link taxonomy vocabulary with a view wich will output appropriate nodes for each term of this vocabulary? In Drupal 7 ...
1
vote
1answer
14 views

Default all entities to English

At some point we will be enabling translations on all entities in Drupal 8. However, we are not ready yet so in the meantime we would like to set all of the entities (content types, taxonomy terms, ...
0
votes
1answer
2k views

how to add class to {% block content %} in twig

Here goes my drupal 8 code, so basically block.html.twig is extended to block--mytheme-sitebranding.html.twig. Now I want to add a class to this: {% block content %} {% if site_logo %} <a ...
1
vote
1answer
16 views

Format for webform submission node tokens?

I have a field on my webform node which is an entity reference to a taxonomy term. I'm printing it in the webform using the token [webform_submission:node:field_sports], which prints the field output, ...
0
votes
2answers
851 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,...
0
votes
0answers
15 views

Unable to alter OEmbed remote video providers

I'm trying to add a remote video provider for OEmbed. I'm using the hook_media_source_info_alter to change the OEmbedDeriver class like this: use .../CustomOEmbedDeriver; /** * Implements ...
0
votes
0answers
22 views

How to install Drupal 8 with composer on Apache server?

I want to install Drupal 8 with the drupal-composer/drupal-project on a server with apache in the public_html folder. The issue is that I want to maintain the folder structure /projectname/web. So, ...
2
votes
1answer
31 views

How do I return a Twig template inside the build method of a block class?

Am new to Drupal and this week I learned quite a bit about module development, and for today the case is: For my new module, I create a custom block that renders a markup, and from the folder ...
0
votes
1answer
460 views

Theme file upload form element

I want to theme all the file upload fields on my site but I don't know how to name the template file. I want to alter the form-element.html.twig file but as I have multiple file fields I don't think ...
1
vote
1answer
781 views

Determining content access by role for viewing content?

Here is the scenario: I have 10 roles (plus the 3 core roles, anon, auth, administrator). I have 7 roles imported from an outside system. Users can belong to multiple roles. Editors need to be able ...
0
votes
0answers
24 views

How can I theme a paragraph on admin edit pages?

I'm struggling to override the template on the admin interface for a content type. I'm going to need to do several modifications to the edit form to meet the editor's requirements, however, I seem to ...
2
votes
0answers
32 views

How can I patch a node via REST in different languages?

I'm using the REST API to get my Drupal content into an app. This app has to be translated to at least 8 different languages, so we are using Crowdin as a translation service. I wrote a small module ...
-2
votes
0answers
31 views

fix-permissions.sh for Drupal 8

With Drupal 7, when I upload a project from local to server, I usually run fix-permisions shell script to change owner and permissions of folder/files. Is provided in : https://www.drupal.org/node/...
-1
votes
1answer
13 views

Can I add a menu link with a parameter? [duplicate]

I would like to add a menu link using the "Link"-Field with Autocomplete, but I would like to add a parameter afterwards. Pretty much like this: ...which is not working. Is that possible? Thanks!
12
votes
4answers
7k views

Looking for database insert example

According to db_insert manual page this function is deprecated and it is better to use Drupal 8 database connection to perform insert. Deprecated as of Drupal 8.0.x, will be removed in Drupal ...
7
votes
3answers
345 views

Deprecate multisite in 8.x for removal in 9.x

I am thinking about implementation of some sites with multi-site and idea of solution (one code-base) is perfect for me even if shared table is not supported any more (my question about shared table ...
0
votes
1answer
791 views

Preprocess Node function not being called

I'm attempting to perform an action in a preprocess node hook inside my .theme file, but I can't seem to get it to fire. Here's the content of my customtheme.theme file <?php function ...
0
votes
1answer
14 views

Multi-page wizard webform that posts to external URL?

I've got a multi-page wizard webform whose results I need to post to a specific URL. I see in the webform settings that you can set a Custom POST url. However, this appears to break the muti-page ...
0
votes
0answers
27 views

Disable validation when previous button is pressed

I have a multistep webform with required fields. The problem is that when I press the "previous"button in order to go to the page before the validation triggers and does not allow me to change the ...
3
votes
1answer
761 views

How to programmatically set the field formatter for a field given certain conditions

I have an entity 'house' with an address field. The address field comes with a default field formatter plugin. This is perfect for when i view my entity at its canonical route and where its view_mode ...
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
1answer
19 views

How can we just apply the updates to a single module using composer without apply patches for other modules?

We have the following composer.json file. When we want to update a module such as Environment Indicator, we run the suggested composer command composer require drupal/environment_indicator:^3.7'. ...
1
vote
2answers
504 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\...