You are here

function focal_point_test_drive_form in Focal Point 7

Form builder for the "test drive" page.

1 string reference to 'focal_point_test_drive_form'
focal_point_menu in ./focal_point.module
Implements hook_menu().

File

./focal_point.admin.inc, line 48
Functionality needed by the focal point admin pages.

Code

function focal_point_test_drive_form($form, &$form_state) {
  $fid = variable_get('focal_point_test_drive_image', NULL);
  $file = !is_null($fid) ? file_load($fid) : NULL;
  $focal_point = variable_get('focal_point_test_drive_focal_point', FOCAL_POINT_DEFAULT);
  if (!empty($fid) && $file) {

    // Display the image and include the focal point indicator and field.
    $form['test_drive_image'] = array(
      '#theme_wrappers' => array(
        'container',
      ),
      'test_drive_indicator' => _focal_point_indicator('test-drive'),
      'test_drive_widget_image' => array(
        '#type' => 'markup',
        '#theme' => 'image_style',
        '#style_name' => 'focal_point_preview',
        '#path' => $file->uri,
      ),
      'focal_point_test_drive_focal_point' => _focal_point_field('test-drive', $focal_point),
    );
  }
  $form['test_drive_submit'] = array(
    '#type' => 'submit',
    '#value' => t('Set the focal point'),
  );
  $form['examples'] = _focal_point_preview($fid, $focal_point);
  $form['#submit'][] = 'focal_point_test_drive_form_submit';
  return $form;
}