You are here

function _formdefaults_search in Form Defaults 7

Same name and namespace in other branches
  1. 5.3 formdefaults.admin.inc \_formdefaults_search()
  2. 6.2 formdefaults.admin.inc \_formdefaults_search()

Search for forms matching wildcard and return all those that match.

Parameters

String $search_str:

Return value

array Array of forms matching search criteria and their definitions

3 calls to _formdefaults_search()
formdefaults_export in ./formdefaults.admin.inc
formdefaults_manage in ./formdefaults.admin.inc
Form management form used for inspecting and resetting forms.
formdefaults_update_7000 in ./formdefaults.install

File

./formdefaults.admin.inc, line 14
formdefaults.admin.inc Include for formdefaults administration screen.

Code

function _formdefaults_search($search_str) {
  $search_str = '%' . $search_str . '%';
  $result = db_query('SELECT * FROM {formdefaults_forms} WHERE formid LIKE :formid', array(
    ':formid' => $search_str,
  ));
  $forms = array();
  foreach ($result as $form) {
    if ($form) {
      $formarray = unserialize($form->formdata);
      $forms[$form->formid] = $formarray;
    }
  }
  return $forms;
}