本文整理汇总了PHP中FormField::getConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP FormField::getConfiguration方法的具体用法?PHP FormField::getConfiguration怎么用?PHP FormField::getConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormField
的用法示例。
在下文中一共展示了FormField::getConfiguration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConfiguration
function getConfiguration()
{
$config = parent::getConfiguration();
if ($config['widget']) {
$config['typeahead'] = $config['widget'] == 'typeahead';
}
//Typeahed doesn't support multiselect for now TODO: Add!
if ($config['typeahead']) {
$config['multiselect'] = false;
}
return $config;
}
示例2: getConfiguration
function getConfiguration()
{
$config = parent::getConfiguration();
$_types = self::getFileTypes();
$mimetypes = array();
$extensions = array();
if (isset($config['mimetypes']) && is_array($config['mimetypes'])) {
foreach ($config['mimetypes'] as $type => $desc) {
foreach ($_types[$type]['types'] as $mime => $exts) {
$mimetypes[$mime] = true;
if (is_array($exts)) {
foreach ($exts as $ext) {
$extensions['.' . $ext] = true;
}
}
}
}
}
if (strpos($config['extensions'], '.*') !== false) {
$config['extensions'] = '';
}
if (is_string($config['extensions'])) {
foreach (preg_split('/\\s+/', str_replace(',', ' ', $config['extensions'])) as $ext) {
if (!$ext) {
continue;
} elseif (strpos($ext, '/')) {
$mimetypes[$ext] = true;
} else {
if ($ext[0] != '.') {
$ext = '.' . $ext;
}
// Ensure that the extension is lower-cased for comparison latr
$ext = strtolower($ext);
// Add this to the MIME types list so it can be exported to
// the @accept attribute
if (!isset($extensions[$ext])) {
$mimetypes[$ext] = true;
}
$extensions[$ext] = true;
}
}
$config['__extensions'] = array_keys($extensions);
} elseif (is_array($config['extensions'])) {
$config['__extensions'] = $config['extensions'];
}
// 'mimetypes' is the array represented from the user interface,
// '__mimetypes' is a complete list of supported MIME types.
$config['__mimetypes'] = array_keys($mimetypes);
return $config;
}