You are here

function imagepicker_browse_search_form in Image Picker 7

Same name and namespace in other branches
  1. 6.2 imagepicker.functions.inc \imagepicker_browse_search_form()

Function to display the image search form

Parameters

$account: Optional user account object.

$admin: Optional admin flag.

Return value

Returns the search form.

3 string references to 'imagepicker_browse_search_form'
_imagepicker_browse in ./imagepicker.functions.inc
_imagepicker_browse_admin in ./imagepicker.functions.inc
_imagepicker_browse_public in ./imagepicker.functions.inc

File

./imagepicker.functions.inc, line 2362
@author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function imagepicker_browse_search_form($form, &$form_state, $account = FALSE, $admin = FALSE) {
  if ($account) {
    $user = $account;
  }
  else {
    global $user;
  }
  $sarr = '';
  if ($admin) {
    $search = imagepicker_variable_get('imagepicker_browser_search', '');
    $sarr = imagepicker_variable_get('imagepicker_browser_search_opts', '');
    $form['admin'] = array(
      '#type' => 'value',
      '#value' => TRUE,
    );
  }
  else {
    $search = imagepicker_variable_get('imagepicker_browser_search', '', $user->uid);
    $sarr = imagepicker_variable_get('imagepicker_browser_search_opts', '', $user->uid);
  }
  $form['imagepicker_browser_search'] = array(
    '#type' => 'textfield',
    '#title' => t('Search'),
    '#size' => 10,
    '#default_value' => $search,
  );
  $form['imagepicker_browser_search_by_name'] = array(
    '#type' => 'checkbox',
    '#title' => t('By Name'),
    '#default_value' => is_array($sarr) ? $sarr['name'] : 0,
  );
  $form['imagepicker_browser_search_by_desc'] = array(
    '#type' => 'checkbox',
    '#title' => t('By Description'),
    '#default_value' => is_array($sarr) ? $sarr['desc'] : 0,
  );
  $form['imagepicker_browser_search_by_title'] = array(
    '#type' => 'checkbox',
    '#title' => t('By Title'),
    '#default_value' => is_array($sarr) ? $sarr['title'] : 0,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Go'),
  );
  $form['reset'] = array(
    '#type' => 'submit',
    '#value' => t('Reset'),
    '#submit' => array(
      'imagepicker_browse_search_form_reset',
    ),
  );
  return $form;
}