I have a slight issue of knowing how to best handle two different topics:
1. I want to make some elements of the existing form uneditable or invisible. How to do it?
I have checked #states variables and basically those could be fine. Unfortunately I have had a problem on utilizing #states variables for existing forms when trying to utilize hook_form_alter. I can easily add new elements to the form and utilize #states variables for those, but for any existing element of the form (edit form of content type) I cannot edit anything but #required state with following type of code:
$form['field_factory_location'][$language]['#required'] = TRUE;
If I try to do same for #visible nothing happens? I have probably totally misunderstood the usage of #states variable. Alternatively I tried something like this (with/without $language which is variable having language of node):
$form['field_factory_location'][$language] = array(
'#states' => array(
'visible' => FALSE ),
);
And obviously this is also something totally incorrect as nothing happens... Any help of my total lack of understanding how #states work?