public function FlexiformElementEntityProperty::configureForm in Flexiform 7
Build the configure form for the element.
Overrides FlexiformElement::configureForm
File
- includes/
element/ property.element.inc, line 160 - Contains class for the entity property elements.
Class
- FlexiformElementEntityProperty
- Class to add an element for entity properties.
Code
public function configureForm($form, &$form_state, $flexiform) {
$form = parent::configureForm($form, $form_state, $flexiform);
$form['required'] = array(
'#type' => 'checkbox',
'#title' => t('Required'),
'#default_value' => !empty($this->settings['required']),
'#weight' => -6,
);
$form['default_value'] = array(
'#tree' => TRUE,
'#type' => 'fieldset',
'#title' => t('Default Value'),
'#weight' => -5,
);
$form['default_value']['default_value'] = array(
'#type' => 'textfield',
'#title' => $this
->label() ? $this
->label() : t('Default'),
'#default_value' => isset($this->settings['default_value']['default_value']) ? $this->settings['default_value']['default_value'] : '',
'#maxlength' => 255,
);
$form['default_value']['use_tokens'] = array(
'#type' => 'checkbox',
'#title' => t('Use Tokens in Default Value'),
'#default_value' => !empty($this->settings['default_value']['use_tokens']),
);
$form['default_value']['contexts'] = array(
'#title' => t('Substitutions'),
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['default_value']['contexts']['contexts'] = $this
->getCtoolsSubstitutionsList();
// Options for handling options.
if (!empty($this->propertyInfo['options list'])) {
$form['options'] = array(
'#tree' => TRUE,
'#type' => 'fieldset',
'#title' => t('Value Selection'),
);
$form['options']['widget'] = array(
'#type' => 'select',
'#title' => t('Widget'),
'#description' => t('What sort of widget to you want to use?'),
'#options' => array(
'select' => t('Select'),
'radios' => t('Radios/Checkboxes'),
),
'#default_value' => !empty($this->settings['options']['widget']) ? $this->settings['options']['widget'] : 'select',
);
}
return $form;
}