本文整理汇总了PHP中SFUtils::getAllValuesForCargoField方法的典型用法代码示例。如果您正苦于以下问题:PHP SFUtils::getAllValuesForCargoField方法的具体用法?PHP SFUtils::getAllValuesForCargoField怎么用?PHP SFUtils::getAllValuesForCargoField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFUtils
的用法示例。
在下文中一共展示了SFUtils::getAllValuesForCargoField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newFromFormFieldTag
//.........这里部分代码省略.........
} elseif ($sub_components[0] == 'default filename') {
$default_filename = str_replace('<page name>', $page_name, $sub_components[1]);
// Parse value, so default filename can
// include parser functions.
$default_filename = $wgParser->recursiveTagParse($default_filename);
$f->mFieldArgs['default filename'] = $default_filename;
} elseif ($sub_components[0] == 'restricted') {
$f->mIsRestricted = !array_intersect($wgUser->getEffectiveGroups(), array_map('trim', explode(',', $sub_components[1])));
}
}
}
// end for
if (!array_key_exists('delimiter', $f->mFieldArgs)) {
$f->mFieldArgs['delimiter'] = ",";
}
$delimiter = $f->mFieldArgs['delimiter'];
// If the 'values' parameter was set, separate it based on the
// 'delimiter' parameter, if any.
if (!empty($values)) {
// Remove whitespaces, and un-escape characters
$valuesArray = array_map('trim', explode($delimiter, $values));
$f->mPossibleValues = array_map('htmlspecialchars_decode', $valuesArray);
}
// If we're using Cargo, there's no equivalent for "values from
// property" - instead, we just always get the values if a
// field and table have been specified.
if (is_null($f->mPossibleValues) && defined('CARGO_VERSION') && $cargo_table != null && $cargo_field != null) {
// We only want the non-null values. Ideally this could
// be done by calling getValuesForCargoField() with
// an "IS NOT NULL" clause, but unfortunately that fails
// for array/list fields.
// Instead of getting involved with all that, we'll just
// remove the null/blank values afterward.
$cargoValues = SFUtils::getAllValuesForCargoField($cargo_table, $cargo_field);
$f->mPossibleValues = array_filter($cargoValues, 'strlen');
}
if (!is_null($f->mPossibleValues)) {
if (array_key_exists('mapping template', $f->mFieldArgs)) {
$f->mPossibleValues = SFUtils::getLabelsFromTemplate($f->mPossibleValues, $f->mFieldArgs['mapping template']);
} elseif (array_key_exists('mapping property', $f->mFieldArgs)) {
$f->mPossibleValues = SFUtils::getLabelsFromProperty($f->mPossibleValues, $f->mFieldArgs['mapping property']);
} elseif (array_key_exists('mapping cargo table', $f->mFieldArgs) && array_key_exists('mapping cargo field', $f->mFieldArgs)) {
$f->mPossibleValues = SFUtils::getLabelsFromCargoField($f->mPossibleValues, $f->mFieldArgs['mapping cargo table'], $f->mFieldArgs['mapping cargo field']);
}
}
// Backwards compatibility.
if ($f->mInputType == 'datetime with timezone') {
$f->mInputType = 'datetime';
$f->mFieldArgs['include timezone'] = true;
} elseif ($f->mInputType == 'text' || $f->mInputType == 'textarea') {
// Backwards compatibility.
$f->mFieldArgs['no autocomplete'] = true;
}
if ($template_in_form->allowsMultiple()) {
$f->mFieldArgs['part_of_multiple'] = true;
}
if (count($show_on_select) > 0) {
$f->mFieldArgs['show on select'] = $show_on_select;
}
// Disable this field if either the whole form is disabled, or
// it's a restricted field and user doesn't have sysop privileges.
$f->mIsDisabled = $form_is_disabled || $f->mIsRestricted;
// Do some data storage specific to the Semantic MediaWiki and
// Cargo extensions.
if (defined('SMW_VERSION')) {
// If a property was set in the form definition,