You are here

function _button_field_widget_settings_image in Button Field 6

Builds the array of setting for the image button widget for button fields.

@todo get file field working

Parameters

string $op:

array $widget:

Return value

array

1 call to _button_field_widget_settings_image()
button_field_widget_settings in ./button_field.module
Implementation of hook_widget_settings().

File

./button_field.module, line 298
Defines a field, widget and formatter for the button field type.

Code

function _button_field_widget_settings_image($op, $widget) {

  // determine the current operation
  switch ($op) {
    case 'form':
      $form = array();

      //      $form['image'] = array(
      //        '#type' => 'file',
      //        '#title' => t('Button image'),
      //        '#default_value' => (isset($widget['image']) ? $widget['image'] : NULL),
      //        '#required' => TRUE,
      //      );
      $form['image_path'] = array(
        '#type' => 'textfield',
        '#title' => t('Image path'),
        '#default_value' => isset($widget['image_path']) ? $widget['image_path'] : NULL,
        '#required' => TRUE,
      );

      // end $form['image_path']
      $form['alt_text'] = array(
        '#type' => 'textfield',
        '#title' => t('Alt text'),
        '#default_value' => isset($widget['alt_text']) ? $widget['alt_text'] : $widget['label'],
        '#required' => TRUE,
      );

      // end $form['alt_text']
      $form['title_text'] = array(
        '#type' => 'textfield',
        '#title' => t('Title text'),
        '#default_value' => isset($widget['title_text']) ? $widget['title_text'] : $widget['label'],
        '#required' => FALSE,
      );

      // end $form['title_text']
      $form = array_merge($form, _button_field_widget_settings_common($op, $widget));
      return $form;
      break;
  }

  // end switch $op
}