How to rerun hook_post_update_NAME()

How to rerun hook_post_update_NAME()

Drupal 8 introduced hook_post_update_NAME() which has some benefits over hook_update_n, for updating modules. Each hook_post_update_NAME() should only run once, but sometimes I want to rerun it, like when I’m debugging the update hook during development. With... read more
How to rerun hook_post_update_NAME()

Issues with the title for a custom entity

I have a custom content entity in which I have defined all the fields in the annotation (and it shouldn’t need to be altered through the UI in any way that I can think of). In the annotation I have the standard keys defined: * entity_keys = { * “id”... read more
Why does YAML parser strippes out underscore?

Why does YAML parser strippes out underscore?

In my Drupal project I have a yaml configuration file which contains an id with the value 16_9 (more precisely it is part of the Crop module configuration). When checking differences between the active Drupal configuration and this staged one, Drupal lists this... read more
How to rerun hook_post_update_NAME()

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 times, I am not getting referer anymore. I tried it with few different... read more
How to rerun hook_post_update_NAME()

How to remove subdir from base URL after installing site with Composer on a shared host?

I’ve managed to install drupal 8 using composer and following script: composer create-project drupal-composer/drupal-project:8.x-dev my_site_name_dir –stability dev –no-interaction I decided to use composer since it seems to be the new way and you... read more
How to rerun hook_post_update_NAME()

Redirect user to previous page after registration

I’d like users registering on my website are redirected to the page where they clicked the “create account” button which is in a modal. First, I tried to redirect to an absolute url I tried $form_state->setRedirect($myUrl); I tried... read more
How to rerun hook_post_update_NAME()

Cannot install bootstrap theme in drupal 8 via composer fresh install

I set up d8 site with: composer create-project drupal-composer/drupal-project:8.x-dev my_test_site –stability dev –no-interaction Then installed the db and drupal with: drush site-install Fully working D8 (8.3.3) with no errors at all. I go to curate the... read more
How to rerun hook_post_update_NAME()

How do I put a <div> around a form?

I have created a form that I will embed in my page with a custom module. How can I wrap this form with a div that has a specific class? I need to add it to the build which is made with the following code. $build = array( ‘form’ => $form,... read more
How to rerun hook_post_update_NAME()

How to prevent site showing wsod in Drupal 8 custom code while using guzzle try block? [closed]

In Drupal 8.5 CMS ,I am using guzzle to call web service .If there is any error i get white screen with error. ‘GuzzleHttpExceptionClientException: Client error’ My code is as follow: try { $response = $this->httpClient->post($endPoint, [... read more
How to rerun hook_post_update_NAME()

Accessing fields from view template

I have a block view which filters for a specifiy content-type. I’d like to fully style it myself and also write the html myself it outputs. So I went and created the file views-view-fields-header-image-slider–block.tpl.php in /templates. Now, I do have the... read more
How to rerun hook_post_update_NAME()

How do I programmatically validate reCaptcha?

In Drupal 7, I use the Commerce_Checkout_Redirect module which uses custom validation functions. It uses the following code. // Use the username as order email. // Email validation for the username form element if... read more
How to rerun hook_post_update_NAME()

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 on D8. I tried to create a routing file in my custom module. So in my... read more
How to rerun hook_post_update_NAME()

How do I add field collection unlimited items from hook_form_alter()?

I am trying to implement what described in Add unlimited field collections in a from of drupal and Field collection with unlimited cardinality pre-populate fields, but the Add more and Remove buttons don’t work. I have issues with drupal_rebuild_form(). The code... read more
How to rerun hook_post_update_NAME()

CKEditor scayt Plugin module

I’m trying to build a scayt module to be able to use the CKEditor scayt Plugin. I tried to use this module but it did not work for me. https://github.com/nikhildodeja/scayt I created my own but I get a WSOD when I veiw a node creat page. The module is below.... read more
Getting values on twig node template

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 content type “Report” in which I have referred... read more
How to rerun hook_post_update_NAME()

Setup custom required field validation for a field in custom form

How can I setup custom required field validation message for a text field in my custom form. I tried below code. But it is not working. It always showing ‘Please fill out this field’. $form[‘first_name’] = [ ‘#type’ =>... read more
How to rerun hook_post_update_NAME()

Views Pager, Can I change Items per page dynamically as provided input?

Is it possible to send Items per page limit in query string of view page url and get records according to that? read more
How to rerun hook_post_update_NAME()

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 with entity query: $query =... read more
How to rerun hook_post_update_NAME()

Add custom submission buttons to navigate through different wizard pages

I need to navigate the user through different pages of a multistep webform. I have added additional submit button to the webform using following code. function mymodule_form_alter(&$form, DrupalCoreFormFormStateInterface $form_state, $form_id) { if($form_id ==... read more
How to rerun hook_post_update_NAME()

How do I implement the login, register and "Forgotten password" forms?

I’m trying to implement the three Drupal 8 user forms : login, register account and forgotten password forms. I’m creating custom pages in my module for each one of them because I want to display content around those forms, change titles, hook the forms.... read more