Skip to content

Commit

Permalink
Datenbanktyp kann festgelegt werden
Browse files Browse the repository at this point in the history
  • Loading branch information
xong committed Aug 31, 2015
1 parent cf60c46 commit 2c9e979
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions classes/value/class.xform.text.inc.php
Expand Up @@ -29,7 +29,7 @@ function enterObject()

function getDescription()
{
return 'text -> Beispiel: text|name|label|defaultwert|[no_db]|cssclassname';
return 'text -> Beispiel: text|name|label|defaultwert|[no_db]|cssclassname|dbtype';
}

function getDefinitions()
Expand All @@ -43,14 +43,23 @@ function getDefinitions()
'default' => array( 'type' => 'text', 'label' => 'Defaultwert'),
'no_db' => array( 'type' => 'no_db', 'label' => 'Datenbank', 'default' => 0),
'css_class' => array( 'type' => 'text', 'label' => 'cssclassname'),
'dbtype' => array( 'type' => 'select', 'label' => 'Datenbanktyp', 'default' => 'text', 'options' => array('text' => 'text', 'mediumtext' => 'mediumtext', 'longtext' => 'longtext', 'varchar(50)' => 'varchar(50)', 'varchar(100)' => 'varchar(100)', 'varchar(255)' => 'varchar(255)', 'date' => 'date', 'datetime' => 'datetime', 'int' => 'int')),
),
'description' => 'Ein einfaches Textfeld als Eingabe',
'dbtype' => 'text',
'famous' => true
'famous' => true,
'hooks' => array(
'preCreate' => 'rex_xform_text::getDBType'
)
);

}

public static function getDBType($params)
{
return $params['dbtype'] ?: 'text';
}

public static function getSearchField($params)
{
$params['searchForm']->setValueField('text', array('name' => $params['field']->getName(), 'label' => $params['field']->getLabel()));
Expand Down

0 comments on commit 2c9e979

Please sign in to comment.