#415 Create XoopsList for XoopsObject Types

XOOPS_2.6
open
nobody
5
2015-01-09
2013-04-06
zyspec
No

It would be useful for module developers to be able to get a list of valid XoopsObject data types. This will facilitate the ability to create dynamic dB fields without the module having to create a list of the current XoopsObject datatypes in the module. (and trying to keep it current with the latest version of the core. A method something like XoopsLists::getObjectDataTypeList() could then return an array:

function getObjectDataTypeList()
{
return array( 1 => 'XOBJ_DTYPE_TXTBOX',
              2 => 'XOBJ_DTYPE_TXTAREA',
              3 => 'XOBJ_DTYPE_INT',
              4 => 'XOBJ_DTYPE_URL',
              5 => 'XOBJ_DTYPE_EMAIL',
              6 => 'XOBJ_DTYPE_ARRAY',
              7 => 'XOBJ_DTYPE_OTHER',
              8 => 'XOBJ_DTYPE_SOURCE',
              9 => 'XOBJ_DTYPE_STIME',
             10 => 'XOBJ_DTYPE_MTIME',
             11 => 'XOBJ_DTYPE_LTIME',
             13 => 'XOBJ_DTYPE_FLOAT',
             14 => 'XOBJ_DTYPE_DECIMAL',
             15 => 'XOBJ_DTYPE_ENUM');
}

This could also be used when the core creates XoopsObject instead of having it defined at the beginning of the ./kernel/object.php class file.

Discussion