I have a content type with fields added from the core module and I want to hide some fields in the edit form, but not in the page node.
I've tried with
$form['my_field']['#access'] = FALSE;
in my custom module, but that hides the field in the node page too.
Is there any other way to hide the field only in edit form?
My approach was to wrap some fields into a two columns. Here's what I've tried:
<?php
/*
* Implements hook_form_alter().
*/
function my_module_form_alter (&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'custom_node_form':
$form['column_left'] = array(
'#prefix' => '<div class="column-left">',
'#suffix' => '</div>',
);
$form['column_left']['custom_field'] = $form['custom_field'];
$form['custom_field']['#access'] = FALSE;
break;
}
}
Unfortunately it's disabling into the page node too. I'm using Display suite for the full content and I'm pretty much sure that the field is not hidden from there.