Leolando Tan
  • Member for 6 years, 11 months
  • Last seen more than a month ago
Is it possible to stop a webform form during submission?
Accepted answer
7 votes

First is I'm not sure if it's best practice to do validations in the submit handler because as you've said, you need to validate first. So I can only answer your second question. To make your ...

View answer
form_state->setRedirect(to_a_new_node_page) from the submitForm function, route "does not exist" issue
Accepted answer
7 votes

I think if you want to use the setRedirect function then you might want to look at its documentation found https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Form%21FormState.php/function/...

View answer
Is there any way to cancel Panels' overlay edit windows?
Accepted answer
6 votes

I did some research and looked into Panels 3 code so far I don't see any nojs fallbacks. You can also check if there are fallbacks when you try to disable Javascript in the browser. This may not be ...

View answer
Using batch api without a form
Accepted answer
4 votes

Based from the first sample code found in Drupal's Batch API page, it says, If this function was called from a form submit handler, stop here, FAPI will handle calling batch_process(). If not ...

View answer
Use a Custom Field in page.tpl.php
Accepted answer
4 votes

Since you want to function on a "page level" (outside the content area) what you can do is: Use hook_preprocess_page Get the node id being viewed Query the node using node_load or just your "term ...

View answer
Views Page Title Based on URL
Accepted answer
3 votes

Since you're using Views and the user name. All you need to do is: Add a Contextual Filter, User: Name Under it's settings pane, under WHEN THE FILTER VALUE IS IN THE URL OR A DEFAULT IS PROVIDED, ...

View answer
How to programmatically refresh the current page?
Accepted answer
3 votes

What you can do is still use Rules for this. Go to your custom rule Under the Actions section, click Add action For Select the action to add, choose Page redirect. For URL, place the internal or ...

View answer
Change article layout on homepage
2 votes

The list of nodes listed in the homepage by default is from the Frontpage(/admin/structure/views/view/frontpage) view. If you'll go to that view, you'll notice on the FORMAT section, under Show, the ...

View answer
How to use the Rules module to implement a custom redirect for an outdated URL?
2 votes

For 301 redirects, you might want to look at the Global Redirect module. Some more details about it (from its project page): GlobalRedirect is a simple module which… Checks the current URL for an ...

View answer
Different css of #main-content at differnt page url?
Accepted answer
2 votes

Option 1 - Pure CSS For those specific pages you can use the classes found in the body tag to override your generic style like so: #main-content { ... } .page-node-123 #main-content { your ...

View answer
How do I print full path?
Accepted answer
2 votes

You can use the url(): $imgurl = drupal_get_path('theme', 'YOURTHEME') . '/images/image.png'; $final_url = url($imgurl, array('absolute' => TRUE)); This will provide a url like http://example.com/...

View answer
tableselect does not work for me somehow 1
2 votes

I copied your code from and commented the variables and/or functions you're using since I don't know what they are for and just replaced a simple array to loop through. /** * Implements hook_menu(). ...

View answer
Using Theme() to output html/javascript in user edit
Accepted answer
2 votes

If you just want to add some markup and Javascript, you don't need a submit callback because that's for handling form submissions. Requirement 1: Add html Options: #prefix and/or #suffix form ...

View answer
Wrap teasers in a div (simple taxonomy page, no views)
Accepted answer
2 votes

Using template.php and hook_preprocess_page() function THEMENAME_preprocess_page(&$variables) { if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) { $...

View answer
Add unlimited field collections in a from of drupal
2 votes

This is a working code that can be placed directly into your form function. Please see the comments too. $node = new stdClass(); // Replace the value to the content type's machine name where you have ...

View answer
How to display a variable in callback hook_menu?
Accepted answer
2 votes

Based on your code, it should be written as $output = array( 'first_para' => array( '#type' => 'markup', '#markup' => '<p>Test</p> ' . $user_agent, ), ); rather ...

View answer
how to get css "background-color" value from content types
1 votes

Drupal 7 What you can do is have a field or just for an example a simple textfield and you can use hook_node_view() or template_preprocess_node() to get the color value and use drupal_add_css(). An ...

View answer
Ability to only allow certain content to be added between a range of dates
1 votes

I would suggest looking into the Rules module for this. Using this module, you can use its Condition feature to: Check the date ranges that you specified Check what content type is being created ...

View answer
How can I select a user role at the time of the account registration?
Accepted answer
1 votes

Good day, Have you tried the Select registration roles module? I think this would be a straightforward configuration for the role field that you want. Hope everything is in order. Thanks!

View answer
Module admin configuration permission
1 votes

Since you're not declaring an access callback, the access callback defaults to the user_access() and passes your access argument into it based on the hook_menu(). Now, when we check the code of ...

View answer
How to set the path for the public directory?
1 votes

You can maybe create a symlink of /var/www/sites/default/files to /var/www/drupal/sites/default/files. Assuming you're inside /var/www/drupal, the command to do that is: ln -s ../sites/default/files ...

View answer
Blocks created using multiblock module are not working
Accepted answer
1 votes

I checked your site out specifically the footer area as you've instructed. This is not the module's issue but a Bootstrap/theming issue. Notice in the screenshot: The block-9 block is using the col-...

View answer
How to make group visible, but content hidden?
Accepted answer
1 votes

Steps: Go to Configuration > Organic groups > OG field settings Under Bundle, select your group content type Under Fields, select Group visibility and click Add field Under Fields again, select Group ...

View answer
Drupal CKeditor image-upload plugins don't delete unused files
Accepted answer
1 votes

Try to check out the Fancy File Delete module. One of the things it can do based on the module page is Deleting unused files from the whole install that are no longer attached to nodes & the ...

View answer
Drupal form disable form error message or use ajax validate instead of #require
Accepted answer
1 votes

So your issue is about displaying the system message on the page when an ajax submit is triggered right? So based on Ajax framework, you need to add the ff. to your $commands array like so: $commands[...

View answer
Edit admin email template for new user registrations
1 votes

If you look into logintoboggan.module you would see that this message is hard-coded and appended using the hook_mail_alter function and that it's altering the Welcome (awaiting approval) (...

View answer
Making both Site name & Site slogan to be one single link in mini-panels
1 votes

I see three options that I think you could do. Update the content in the theme layer which you can try to check in this page and it's other related pages. https://www.drupal.org/node/1678810 Use ...

View answer
How to manipulate some fields using Views PHP?
1 votes

An option you can try is by using the Views Field View module. This allows you to call/render the output of another view as fields in the parent view. Here we will be creating a View to display your ...

View answer
Background CSS images won't be changed after reuploading & Cache flushing
1 votes

Since all caching aren't able to fix, let's try narrowing down the issue. First, try to delete the image from your theme. Flush all caches and see if the background image is still there. If it is, ...

View answer
hook_form_alter setting select list #options key allow attributes per option
1 votes

Based on theme_select which is the one that constructs and styles the Drupal Form API's select type. It uses the form_select_options function do create the <option> tags. So you would need to ...

View answer