Skip to content

Instantly share code, notes, and snippets.

@marcogrueter
Created July 1, 2015 09:42
Show Gist options
  • Save marcogrueter/02b5e70f02402d999059 to your computer and use it in GitHub Desktop.
Save marcogrueter/02b5e70f02402d999059 to your computer and use it in GitHub Desktop.
<?php defined('BASEPATH') or exit('No direct script access allowed');
/**
* PyroStreams Text Field Type
*
* extended field type based on the basic text field type, mgr
*
* @package PyroStreams
* @author PyroCMS Dev Team
* @copyright Copyright (c) 2011 - 2013, PyroCMS
*/
class Field_paramtext
{
public $field_type_slug = 'paramtext';
public $db_col_type = 'varchar';
public $version = '1.0.0';
public $author = array('name'=>'Parse19', 'url'=>'http://parse19.com');
public $custom_parameters = array('max_length', 'default_value', 'placeholder', 'class');
// --------------------------------------------------------------------------
/**
* Output form input
*
* @param array
* @param array
* @return string
*/
public function form_output($data)
{
$options['name'] = $data['form_slug'];
$options['id'] = $data['form_slug'];
$options['placeholder'] = $data['placeholder'];
$options['class'] = $data['class'];
$options['value'] = $data['value'];
if (isset($data['max_length']) and is_numeric($data['max_length']))
{
$options['maxlength'] = $data['max_length'];
}
return form_input($options);
}
// --------------------------------------------------------------------------
/**
* Pre Output
*
* No PyroCMS tags in text input fields.
*
* @return string
*/
public function pre_output($input)
{
$this->CI->load->helper('text');
return escape_tags($input);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment