/** * Display Field */ function display_field($field_name, $data, $settings, $cell = FALSE) { global $FF, $IN; $this->_include_theme_css('styles/pt_switch.css'); $this->_include_theme_js('scripts/pt_switch.js'); $field_id = str_replace(array('[', ']'), array('_', ''), $field_name); if ($cell) { $new = !(isset($FF->row['entry_id']) ? $FF->row['entry_id'] : $IN->GBL('entry_id')) || $field_name == '{DEFAULT}'; } else { $new = !(isset($FF->row['entry_id']) ? $FF->row['entry_id'] : $IN->GBL('entry_id')); $this->insert_js('new ptSwitch(jQuery("#' . $field_id . '"));'); } // Pretend it's a new entry if $data isn't set to one of the values if ($data != $settings['off_val'] && $data != $settings['on_val']) { $new = TRUE; } $options = array($settings['off_val'] => $settings['off_label'], $settings['on_val'] => $settings['on_label']); if ($new) { $data = $settings[$settings['default'] . '_val']; } $SD = new Fieldframe_SettingsDisplay(); return '<select id="' . $field_id . '" name="' . $field_name . '">' . $SD->_select_options($data, $options) . '</select>'; }
/** * Display Field */ function display_field($field_name, $data, $settings, $cell = FALSE) { $this->_include_theme_css('styles/pt_pill.css'); $this->_include_theme_js('scripts/pt_pill.js'); $field_id = str_replace(array('[', ']'), array('_', ''), $field_name); // ------------------------------------------- // Insert the JS // ------------------------------------------- if (!$cell) { $this->insert_js('new ptPill(jQuery("#' . $field_id . '"));'); } // default? if (!$data && isset($settings['default'])) { $data = $settings['default']; } $SD = new Fieldframe_SettingsDisplay(); return '<select id="' . $field_id . '" name="' . $field_name . '">' . $SD->_select_options($data, $settings['options']) . '</select>'; }