Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8124351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:26:05+00:00 2026-06-06T06:26:05+00:00

I want to build a module that adds an extra field on the search

  • 0

I want to build a module that adds an extra field on the search form block configuration page to store text that will be displayed as the HTML5 placeholder attribute. What hooks do I need to use and how do I modify just the search form block to have that extra texbox that then gets printed on the page?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T06:26:07+00:00Added an answer on June 6, 2026 at 6:26 am

    This is the code that finally worked, thanks for your help:

    function yourmodule_form_alter(&$form, &$form_state, $form_id) {  
      if (($form_id == 'block_admin_configure') && ($form['module']['#value'] == 'search')) {
        $form['settings']['theplaceholder'] = array(
          '#type' => 'textfield', 
          '#title' => t('Add placeholder text'), 
          '#default_value' => variable_get('theplaceholder'),
          '#maxlength' => 64,
          '#description' => 'Override the default placeholder',
          '#weight' => 2,
          '#access' => TRUE,
        );
        $form['#submit'][] = 'yourmodule_submit_function';
      }
    
    if ($form_id == 'search_block_form') {
        $form['search_block_form']['#attributes']['placeholder'] = variable_get('theplaceholder');
      }
    }
    function yourmodule_submit_function($delta = '', $edit = array()){  
        variable_set('theplaceholder', $edit['values']['theplaceholder']);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to build a form_tag that will allow me to post a new
I have a Java multi-module Maven project that I want to build an MVN
I know that there is a build in module Orchard.Users. I want to include
I want build a sketch pad app on iPhone, I assume that this type
I want to build flash application that can detect the user eyes color and
I want to build a python program that deletes all the photos from my
Here's what I want to do: I want to build a test suite that's
I want to build a project that has 2 embedded controllers that talk wirelessly
Is there a module or similar things that support skinning in NodeJS? I want
I want to build an iOS module in which I have a viewController class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.