public function FlexiformFormEntityEntityReference::configForm in Flexiform 7
Get the Configuration Form.
Overrides FlexiformFormEntityBase::configForm
File
- includes/
form_entity/ entityreference.form_entity.inc, line 97 - Contains class for a basic entity getter.
Class
- FlexiformFormEntityEntityReference
- Form Entity Class for Managing the Entity Reference fields
Code
public function configForm($form, &$form_state) {
$form = parent::configForm($form, $form_state);
$field = field_info_field($this->getter['field_name']);
// Allow the selection of which one to use.
if ($field['cardinality'] != 1) {
$options = array();
$i = 0;
while ($i < 10) {
if ($field['cardinality'] > 0 && $i >= $field['cardinality']) {
break;
}
$options[$i] = $i + 1;
++$i;
}
$form['settings']['delta'] = array(
'#title' => t('Delta'),
'#description' => t('Select which value of this field you want to use.'),
'#type' => 'select',
'#options' => $options,
'#default_value' => !empty($this->settings['delta']) ? $this->settings['delta'] : 0,
);
}
$form['settings']['create'] = array(
'#title' => t('Create if Empty'),
'#description' => t('When ticked, if the field is empty, a new entity will be created.'),
'#type' => 'checkbox',
'#default_value' => !empty($this->settings['create']),
);
return $form;
}