This snippet shows how to remove form elements in Drupal. I am using hook_form_alter and access parameter from form api.
Source code viewer
/**
* Implements hook_form_alter().
*/
function HOOK_form_alter(&$form, &$form_state, $form_id) {
// Remove fields with only functional purpose, not for human eyes.
$form['field_date']['#access'] = FALSE;
$form['field_count']['#access'] = FALSE;
}
}Programming Language: PHP