Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function civsearch_property_labels_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
- if (isset($items[$delta]['label'])) {
- $default_label = $items[$delta]['label'];
- }
- if (isset($items[$delta]['value'])) {
- $default_value = $items[$delta]['value'];
- }
- // We are unserializing the variable_get because the string that was
- // serialized with variable_set was a serialized array. So we need to run the
- // unserialize process one more time.
- $options = array();
- $list_items = unserialize(variable_get('civsearch_property_labels', ''));
- foreach ($list_items as $list_item) {
- $explode = explode('|', $list_item);
- $options[$explode[0]] = $explode[1];
- }
- $labels = $element;
- $labels += array(
- '#type' => 'select',
- '#title' => t('Label'),
- '#options' => $options,
- '#default_value' => isset($default_label) ? $default_label : '',
- '#suffix' => '<br >',
- );
- $values = $element;
- $values += array(
- '#type' => 'textarea',
- '#title' => t('Value'),
- '#default_value' => isset($default_value) ? $default_value : '',
- );
- return array(
- 'label' => $labels,
- 'value' => $values,
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement