Thursday, April 30, 2020

how to hide exposed filter programmatically label and fields in drupal 7

 /**
 * Implements hook_form_alter().
 */
function module_name_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'views_exposed_form' && $form['#id'] == 'views-exposed-form-user-conversations-owner-conversations' || $form_id == 'views_exposed_form' && $form['#id'] == views-exposed-form-user-conversations-space-user-conversations') {
    $form["field_name1"]["#access"] = FALSE;
    $form["field_name"]["#access"] = FALSE;
    $form["#info"]["filter-conversation_status_value_i18n"]["label"] = '';
  }
}

No comments:

Post a Comment

If you have any problem please let me know.