How to edit Advanced Search Form's Content Type checkbox-list using hook_form_alter I have a Drupal 7 setup. I want to remove few Content types from the Content Type checklist that appears in Advanced Search form. I could see that advanced search form comes in 'advanced' field-set of 'search_form'.

I tried to implement the solution given here, but I am not able to find the advanced array in $form.

I would also like to add styling changes and prefix elements to default text-fields that comes within Advanced Search form


Please find the below code that displays content of $form ($form_id = search_form), as I can't find advanced array within it.

    Array
(
    [#action] =&gt; /demodrupal7/search/node
    [#attributes] =&gt; Array
        (
            [class] =&gt; Array
                (
                    [0] =&gt; search-form
                )

        )

    [module] =&gt; Array
        (
            [#type] =&gt; value
            [#value] =&gt; node
        )

    [basic] =&gt; Array
        (
            [#type] =&gt; container
            [#attributes] =&gt; Array
                (
                    [class] =&gt; Array
                        (
                            [0] =&gt; container-inline
                        )

                )

            [keys] =&gt; Array
                (
                    [#type] =&gt; textfield
                    [#title] =&gt; Enter your keywords
                    [#default_value] =&gt; 
                    [#size] =&gt; 40
                    [#maxlength] =&gt; 255
                )

            [processed_keys] =&gt; Array
                (
                    [#type] =&gt; value
                    [#value] =&gt; 
                )

            [submit] =&gt; Array
                (
                    [#type] =&gt; submit
                    [#value] =&gt; Search
                )

        )

    [#form_id] =&gt; search_form
    [#type] =&gt; form
    [#build_id] =&gt; form-wAV_M_UAj5lbJgb-6vcdpmtxls5NpioPam6uNtkzRnw
    [form_build_id] =&gt; Array
        (
            [#type] =&gt; hidden
            [#value] =&gt; form-wAV_M_UAj5lbJgb-6vcdpmtxls5NpioPam6uNtkzRnw
            [#id] =&gt; form-wAV_M_UAj5lbJgb-6vcdpmtxls5NpioPam6uNtkzRnw
            [#name] =&gt; form_build_id
            [#parents] =&gt; Array
                (
                    [0] =&gt; form_build_id
                )

        )

    [#token] =&gt; search_form
    [form_token] =&gt; Array
        (
            [#id] =&gt; edit-search-form-form-token
            [#type] =&gt; token
            [#default_value] =&gt; 374_q2sHn_uhIvUhwOdrriFMIM3UgfVoc7Jzsh_DHrE
            [#parents] =&gt; Array
                (
                    [0] =&gt; form_token
                )

        )

    [form_id] =&gt; Array
        (
            [#type] =&gt; hidden
            [#value] =&gt; search_form
            [#id] =&gt; edit-search-form
            [#parents] =&gt; Array
                (
                    [0] =&gt; form_id
                )

        )

    [#id] =&gt; search-form
    [#method] =&gt; post
    [#theme_wrappers] =&gt; Array
        (
            [0] =&gt; form
        )

    [#icon] =&gt; 
    [#icon_position] =&gt; before
    [#process] =&gt; Array
        (
            [0] =&gt; bootstrap_form_process
        )

    [#pre_render] =&gt; Array
        (
            [0] =&gt; bootstrap_pre_render
        )

    [#tree] =&gt; 
    [#parents] =&gt; Array
        (
        )

    [#validate] =&gt; Array
        (
            [0] =&gt; search_form_validate
        )

    [#submit] =&gt; Array
        (
            [0] =&gt; search_form_submit
        )

    [#theme] =&gt; Array
        (
            [0] =&gt; search_form
        )

)


Can anyone help me with this.
Thanks in advance.
The advanced fields are added by the node.module in node_form_search_form_alter() (a hook_form_FORM_ID_alter() implementation). It sounds like your module's hook_form_alter() is getting called before the node.module one, so you're not seeing it's additions.

The ordering of when hooks are fired is controlled by the weight column in the system table. Have you altered that previously for your module? Usually, node.module has a weight of 0 so if your module comes before that in the rows in the system table when sorted by weight then that will be your problem.