You are here

function form_builder_examples_property_key_form in Form Builder 7.2

Configuration form for the "key" property.

The key property is special in that it's not actually part of the element, but instead the array key that is used to reference the element in the Form API structure.

1 string reference to 'form_builder_examples_property_key_form'
form_builder_examples_form_builder_properties in examples/form_builder_examples.module
Implementation of hook_form_builder_properties().

File

examples/form_builder_examples.properties.inc, line 17
form_builder_examples.properties.inc Implementations of hook_form_builder_properties in separate functions.

Code

function form_builder_examples_property_key_form(&$form_state, $form_type, $element, $property) {
  $form = array();
  $form['key'] = array(
    '#title' => t('Form key'),
    '#type' => 'machine_name',
    '#default_value' => $element['#key'],
    '#maxlength' => 128,
    '#description' => t('The form key is used in the field "name" attribute. Must be alphanumeric and underscore characters.'),
    '#machine_name' => array(
      'source' => array(
        'title',
      ),
      'label' => t('Form key'),
    ),
    '#weight' => -9,
    '#element_validate' => array(
      'form_builder_examples_property_key_form_validate',
    ),
  );
  return $form;
}