<?php /** * Elgg manage field page * * @package Form * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 * @author Kevin Jardine <*****@*****.**> * @copyright Radagast Solutions 2008 * @link http://radagast.biz/ * * @uses $vars['field'] The field to edit * $vars['form_id'] The form to add a new field to * $vars['new_field_name'] Optionally, an internal name for this field */ $form_field_types = form_get_form_field_types(); $i = 0; foreach ($form_field_types as $type => $ft) { if ($type == 'contact') { $contact_index = $i; } else { if ($type == 'choices') { $choices_index = $i; } } $i += 1; } $form_id = $vars['form_id']; $field = $vars['field']; $choices = $vars['choices']; $page_return_type = $vars['page_return_type'];
function form_field_type_to_view($field_type, $mode) { $form_field_types = form_get_form_field_types(); // circumvent Elgg metadata bug $field_type = strtolower($field_type); // special handling for choices and contacts // TODO: remove the need for special handling if ($mode == 'output') { if (in_array($field_type, array('email', 'url'))) { $view = 'output/' . $field_type; } else { if (in_array($field_type, array('aim', 'msn', 'skype', 'icq'))) { $view = 'output/text'; } else { $view = $form_field_types[$field_type]->output_view; } } } else { if (in_array($field_type, array('radio', 'checkboxes'))) { $view = 'form/input/' . $field_type; } else { if ($field_type == 'pulldown') { $view = 'input/pulldown'; } else { if (in_array($field_type, array('email', 'url', 'aim', 'msn', 'skype', 'icq'))) { $view = 'input/text'; } else { $view = $form_field_types[$field_type]->input_view; } } } } return $view; }