I have have a field of type container that is acting as a title field, see complete definintion below.
My issue is that I cannot seem to modify the title or description via form_alter, I have tried the following approaches:
$form['title_field'][$language->language][0]['#title'] = $form['title_field'][$language->language][0]['#title'] . t(' (maximum @max characters)', array( '@max' => $maximum_program_title_limit));
And also:
$form['title_field'][LANGUAGE_NONE][0]['#title'] = $form['title_field'][LANGUAGE_NONE][0]['#title'] . t(' (maximum @max characters)', array( '@max' => $maximum_program_title_limit));
I tried both "language" options, and also tried at one higher level of the array:
$form['title_field'][LANGUAGE_NONE]['#title'] = $form['title_field'][LANGUAGE_NONE]['#title'] . t(' (maximum @max characters)', array( '@max' => $maximum_program_title_limit));
None of these take effect on the form, although other changes are actually done on the form in this same function.
Array
(
[#type] => container
[#attributes] => Array
(
[class] => Array
(
[0] => field-type-text
[1] => field-name-title-field
[2] => field-widget-text-textfield
)
)
[#weight] => -5
[#tree] => 1
[#language] => und
[und] => Array
(
[0] => Array
(
[#entity_type] => node
[#entity] => stdClass Object
(
[vid] => 27
[uid] => 1
[title] => program 2-11
[log] =>
[status] => 1
[comment] => 0
[promote] => 0
[sticky] => 0
[nid] => 13
[type] => program
[language] => und
[created] => 1440515144
[changed] => 1440515144
[tnid] => 0
[translate] => 0
[revision_timestamp] => 1440515144
[revision_uid] => 1
[body] => Array
(
)
[field_ambassadeurs_ambassadors] => Array
(
)
[field_organization_organisation] => Array
(
[und] => Array
(
[0] => Array
(
[target_id] => 2
)
)
)
[field_participant_reg] => Array
(
[und] => Array
(
[0] => Array
(
[registration_type] => participant_participante
)
)
)
[field_prog_attachment] => Array
(
)
[field_program_template_ref] => Array
(
[und] => Array
(
[0] => Array
(
[target_id] => 11
)
)
)
[title_field] => Array
(
[und] => Array
(
[0] => Array
(
[value] => program 2-11
[format] =>
[safe_value] => program 2-11
)
)
)
[title_original] => program 2-11
[translations] => stdClass Object
(
[original] =>
[data] => Array
(
)
)
[rdf_mapping] => Array
(
[rdftype] => Array
(
[0] => sioc:Item
[1] => foaf:Document
)
[title] => Array
(
[predicates] => Array
(
[0] => dc:title
)
)
[created] => Array
(
[predicates] => Array
(
[0] => dc:date
[1] => dc:created
)
[datatype] => xsd:dateTime
[callback] => date_iso8601
)
[changed] => Array
(
[predicates] => Array
(
[0] => dc:modified
)
[datatype] => xsd:dateTime
[callback] => date_iso8601
)
[body] => Array
(
[predicates] => Array
(
[0] => content:encoded
)
)
[uid] => Array
(
[predicates] => Array
(
[0] => sioc:has_creator
)
[type] => rel
)
[name] => Array
(
[predicates] => Array
(
[0] => foaf:name
)
)
[comment_count] => Array
(
[predicates] => Array
(
[0] => sioc:num_replies
)
[datatype] => xsd:integer
)
[last_activity] => Array
(
[predicates] => Array
(
[0] => sioc:last_activity_date
)
[datatype] => xsd:dateTime
[callback] => date_iso8601
)
)
[name] => admin
[picture] => 0
[data] => b:0;
[date] => 2015-08-25 17:05:44 +0200
[revision] => 1
[menu] => Array
(
[link_title] =>
[mlid] => 0
[plid] => 0
[menu_name] => main-menu
[weight] => 0
[options] => Array
(
)
[module] => menu
[expanded] => 0
[hidden] => 0
[has_children] => 0
[customized] => 0
[parent_depth_limit] => 8
)
)
[#bundle] => program
[#field_name] => title_field
[#language] => und
[#field_parents] => Array
(
)
[#columns] => Array
(
[0] => value
[1] => format
)
[#title] => Additional title ( optional ) (maximum 50 characters)
[#description] => This field is optional, any text entered here will be added between parenthesis after the default program title shown above. (maximum 50 characters)
[#required] =>
[#delta] => 0
[#weight] => 0
[value] => Array
(
[#entity_type] => node
[#entity] => stdClass Object
(
[vid] => 27
[uid] => 1
[title] => program 2-11
[log] =>
[status] => 1
[comment] => 0
[promote] => 0
[sticky] => 0
[nid] => 13
[type] => program
[language] => und
[created] => 1440515144
[changed] => 1440515144
[tnid] => 0
[translate] => 0
[revision_timestamp] => 1440515144
[revision_uid] => 1
[body] => Array
(
)
[field_ambassadeurs_ambassadors] => Array
(
)
[field_organization_organisation] => Array
(
[und] => Array
(
[0] => Array
(
[target_id] => 2
)
)
)
[field_participant_reg] => Array
(
[und] => Array
(
[0] => Array
(
[registration_type] => participant_participante
)
)
)
[field_prog_attachment] => Array
(
)
[field_program_template_ref] => Array
(
[und] => Array
(
[0] => Array
(
[target_id] => 11
)
)
)
[title_field] => Array
(
[und] => Array
(
[0] => Array
(
[value] => program 2-11
[format] =>
[safe_value] => program 2-11
)
)
)
[title_original] => program 2-11
[translations] => stdClass Object
(
[original] =>
[data] => Array
(
)
)
[rdf_mapping] => Array
(
[rdftype] => Array
(
[0] => sioc:Item
[1] => foaf:Document
)
[title] => Array
(
[predicates] => Array
(
[0] => dc:title
)
)
[created] => Array
(
[predicates] => Array
(
[0] => dc:date
[1] => dc:created
)
[datatype] => xsd:dateTime
[callback] => date_iso8601
)
[changed] => Array
(
[predicates] => Array
(
[0] => dc:modified
)
[datatype] => xsd:dateTime
[callback] => date_iso8601
)
[body] => Array
(
[predicates] => Array
(
[0] => content:encoded
)
)
[uid] => Array
(
[predicates] => Array
(
[0] => sioc:has_creator
)
[type] => rel
)
[name] => Array
(
[predicates] => Array
(
[0] => foaf:name
)
)
[comment_count] => Array
(
[predicates] => Array
(
[0] => sioc:num_replies
)
[datatype] => xsd:integer
)
[last_activity] => Array
(
[predicates] => Array
(
[0] => sioc:last_activity_date
)
[datatype] => xsd:dateTime
[callback] => date_iso8601
)
)
[name] => admin
[picture] => 0
[data] => b:0;
[date] => 2015-08-25 17:05:44 +0200
[revision] => 1
[menu] => Array
(
[link_title] =>
[mlid] => 0
[plid] => 0
[menu_name] => main-menu
[weight] => 0
[options] => Array
(
)
[module] => menu
[expanded] => 0
[hidden] => 0
[has_children] => 0
[customized] => 0
[parent_depth_limit] => 8
)
)
[#bundle] => program
[#field_name] => title_field
[#language] => und
[#field_parents] => Array
(
)
[#columns] => Array
(
[0] => value
[1] => format
)
[#title] => Additional title ( optional )
[#description] => This field is optional, any text entered here will be added between parenthesis after the default program title shown above.
[#required] =>
[#delta] => 0
[#weight] => 0
[#type] => textfield
[#default_value] => program 2-11
[#size] => 60
[#maxlength] => 60
[#attributes] => Array
(
[class] => Array
(
[0] => text-full
)
[maxlength_js_label] => Array
(
[0] => Content limited to @limit characters, remaining: <strong>@remaining</strong>
)
)
[#maxlength_js] => 1
)
[#maxlength] => 50
[#maxlength_js] => 1
[#attributes] => Array
(
[maxlength_js_label] => Array
(
[0] => Content limited to @limit characters, remaining: <strong>@remaining</strong>
)
)
[#prefix] => <div id="title_prefix"><strong>Default program title:</strong> template 1</div>
)
[#theme] => field_multiple_value_form
[#field_name] => title_field
[#cardinality] => 1
[#title] => Additional title ( optional ) (maximum 50 characters)
[#required] => 0
[#description] => This field is optional, any text entered here will be added between parenthesis after the default program title shown above. (maximum 50 characters)
[#prefix] => <div id="title-field-add-more-wrapper">
[#suffix] => </div>
[#max_delta] => 0
[#after_build] => Array
(
[0] => field_form_element_after_build
)
[#language] => und
[#field_parents] => Array
(
)
[#maxlength] => 1
[#maxlength_js] => 1
[#attributes] => Array
(
[maxlength_js_label] => Array
(
[0] => Content limited to @limit characters, remaining: <strong>@remaining</strong>
)
)
)
[#access] => 1
)
I would like to know what is missing for this form_alter to work as should?
$form['title_field'][LANGUAGE_NONE][0]['value']['#title']
or$form['title_field'][LANGUAGE_NONE]['value']['#title']
(I never remember which 'til I get there)