Skip to content
This repository has been archived by the owner on Dec 18, 2021. It is now read-only.

Datenbanktyp kann festgelegt werden #322

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions classes/value/class.xform.text.inc.php
Original file line number Diff line number Diff line change
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