Added new fields and forms
This commit is contained in:
parent
52d75b8029
commit
9db16a5edd
27 changed files with 832 additions and 34 deletions
51
src/CoreFields/NormalizeField.php
Normal file
51
src/CoreFields/NormalizeField.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Antonio de la Rosa <webmaster@web-t-sys.com>
|
||||
* @file
|
||||
* @package ExtraFields
|
||||
*
|
||||
*/
|
||||
|
||||
namespace PhangoApp\PhaModels\CoreFields;
|
||||
|
||||
class NormalizeField extends TextField {
|
||||
|
||||
|
||||
public $form='HiddenForm';
|
||||
|
||||
public function check($value)
|
||||
{
|
||||
|
||||
|
||||
return $this->check_text($value);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function search_field($value)
|
||||
{
|
||||
|
||||
return $this->check_text($value);
|
||||
|
||||
}
|
||||
|
||||
static public function check_text($value, $separator='-')
|
||||
{
|
||||
|
||||
$str_normalize=slugify(strip_tags($value));
|
||||
|
||||
$arr_normalize=explode($separator, $str_normalize);
|
||||
|
||||
sort($arr_normalize);
|
||||
|
||||
$value=implode('%', $arr_normalize);
|
||||
|
||||
return $value;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue