You are here

function field_patterns_params in Patterns 7

Same name and namespace in other branches
  1. 7.2 patterns_components/components/field.inc \field_patterns_params()

File

patterns_components/components/field.inc, line 261
Patterns component for Fields.

Code

function field_patterns_params($action, $form_id, &$data) {
  if ($form_id == 'field_ui_field_overview_form') {
    $result = array(
      $data['entity_type'],
      $data['bundle'],
    );
  }
  elseif ($form_id == 'field_ui_field_edit_form') {
    _field_info_collate_fields(true);
    _field_info_collate_types(true);
    $instance = field_info_instance($data['entity_type'], $data['field_name'], $data['bundle']);
    $result = array(
      $instance,
    );
  }
  elseif ($form_id == 'field_ui_field_delete_form') {

    /*
    * delete all the field instance with the field_name
    * $fname = $data['field_name'];
        $instance = db_query("SELECT * FROM {field_config_instance} WHERE field_name = :fname", array('fname' => $fname))->fetchAssoc();
    */
    $result = array(
      array(
        'bundle' => $data['bundle'],
        'entity_type' => $data['entity_type'],
        'field_name' => $data['field_name'],
      ),
    );
  }
  elseif ($form_id == 'field_ui_field_settings_form') {
    $result = array(
      array(
        'bundle' => $data['bundle'],
        'entity_type' => $data['entity_type'],
        'field_name' => $data['field_name'],
      ),
    );
  }
  return patterns_results(PATTERNS_SUCCESS, t('Execution successful'), $result);
}