Showing posts with label Drupal. Show all posts
Showing posts with label Drupal. Show all posts

Monday, August 16, 2021

After Web Form Summited Zip file auto download


jQUERY CODE

-------------------------

 jQuery(function() {

jQuery('a[data-auto-download]').each(function(){

var $this = jQuery(this);

setTimeout(function() {

window.location = $this.attr('href');

}, 2000);

});

});

The below HTML code should be placed in the place of success message to make the zip file auto downlaod. 

HTML CODE:

------------------------------

<a class="button" data-auto-download="" href="/download.zip">click here</a>

Friday, January 22, 2021

Disabling a Module via the Database in Drupal 8

 

1) In D7 you could do this in the systems table by setting the status to 0. In D8, however this is stored in the config table. You can edit the blob value in the data field for this result:

SELECT * FROM config WHERE name like '%.extension%';


2) Or here's the fast (but dirty) solution:

- Delete the module's folder from the file system (/modules/

- truncate table cache_config using below commands 

 ---------------------------------------------------------------------


TRUNCATE cache_config;

TRUNCATE cache_container;

TRUNCATE cache_data;

TRUNCATE cache_default;

TRUNCATE cache_discovery;

TRUNCATE cache_dynamic_page_cache;

TRUNCATE cache_entity;

TRUNCATE cache_menu;

TRUNCATE cache_render;

TRUNCATE cache_toolbar;

Thursday, August 9, 2018

Drupal Menu not Saving Due to max_input_vars

Add below line to the php.ini or .user.ini which is located in site root folder, if this file is not available you care create and add this line and upload it to the server.
------------------------------------------
max_input_vars = 2000
------------------------------------------

OR

Add these lines to your .htaccess file:
php_value post_max_size = 20000M
php_value upload_max_filesize = 20000M
php_value max_execution_time = 30000
php_value max_input_time = 60000
php_value memory_limit = 8000M
php_value max_input_vars = 8000
php_value suhosin.post.max_vars = 8000
php_value suhosin.request.max_vars = 8000

Tuesday, June 19, 2018

Drupal special characters showing like & and   etc... in drupal page title. Code for fix

Replace below code in page.tpl:
<?php print html_entity_decode($head_title) ?>
instead of
<?php //print $title; ?>

Thursday, April 20, 2017

How to add drupal block into a node?

<?php
     $block = module_invoke('block_name', 'block_view', 'block_id');
     print render($block['content']);
 ?>

Wednesday, February 24, 2016

jQuery to match an input field value against a pre-defined value on focusout | Drupal Den

Here is how to show a message on a form when the input field loses focus and it matches a predefined value. In this example a message appears if the user enters an email address that matches the domain of a free email provider, eg. Hotmail, Yahoo & Gmail.
NOTE: this doesn't validate and stop the user from being able to submit the form, it's just a message that appears. If you use the Webform module and want to prevent a user from submitting a form you can do this by also enabling the Webform Validation module and adding a Form Validation Rule of the type Words Blacklist.
Anyway back to creating a jQuery message which appears when a form input value matches a predefined value...
The below script checks for a match when the field loses focus - in this instance it's checking for '@hotmail.', '@yahoo.' & '@gmail.'. It was done in this way so that it matches for both '@yahoo.com' and '@yahoo.co.uk', and isn't case sensitive. You can build quite complex rules for matching using JavaScript regular expressions (RegEx).
The message is inserted directly after the email input field, and is removed once the match isn't found anymore.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<form>
    <input class="form-email" type="email" id="edit-submitted-email-address" name="submitted[email_address]" size="60">
</form>
 
<script>
(function ($) {     
    $('input.form-email').focusout(function(){
        var match = $(this).val().match(/@hotmail\.|@yahoo\.|@gmail\./gi);
        if(match){
                $(this).not('.emailAlertActive').after( '<p class="emailAlert">Please use your business email address.</p>' ).addClass('emailAlertActive');
        } else {
            $(this).siblings('.emailAlert').remove();
            $(this).removeClass('emailAlertActive')
        }
    })})(jQuery);
</script>

Thursday, May 24, 2012

ARCHIVE: Increase PHP memory limit (4 methods)

Add this line in you drupal settings.php file, change the size if you want.

ini_set('memory_limit', '64M');

http://drupal.org/node/29268

Tuesday, May 15, 2012

block content from $node->field

<?php if (arg(0) == 'node' && is_numeric(arg(1)) ) { $node = node_load(arg(1)); if($node->type == 'article') { print $node->body['und'][0]['value']; } } ?>