当前位置: 首页>>代码示例>>PHP>>正文


PHP SFUtils::getValuesForCargoField方法代码示例

本文整理汇总了PHP中SFUtils::getValuesForCargoField方法的典型用法代码示例。如果您正苦于以下问题:PHP SFUtils::getValuesForCargoField方法的具体用法?PHP SFUtils::getValuesForCargoField怎么用?PHP SFUtils::getValuesForCargoField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SFUtils的用法示例。


在下文中一共展示了SFUtils::getValuesForCargoField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: formHTML


//.........这里部分代码省略.........
                            } elseif ($sub_components[0] == 'cargo table') {
                                $cargo_table = $sub_components[1];
                            } elseif ($sub_components[0] == 'cargo field') {
                                $cargo_field = $sub_components[1];
                            } 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);
                                $field_args['default filename'] = $default_filename;
                            } elseif ($sub_components[0] == 'restricted') {
                                $is_restricted = !array_intersect($wgUser->getEffectiveGroups(), array_map('trim', explode(',', $sub_components[1])));
                            }
                        }
                    }
                    // end for
                    if (array_key_exists('delimiter', $field_args)) {
                        $delimiter = $field_args['delimiter'];
                    } else {
                        $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
                        $possible_values = array_map('trim', explode($delimiter, $values));
                        $possible_values = array_map('htmlspecialchars_decode', $possible_values);
                    }
                    // 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($possible_values) && defined('CARGO_VERSION') && $cargo_table != null && $cargo_field != null) {
                        $possible_values = SFUtils::getValuesForCargoField($cargo_table, $cargo_field, $cargo_field . " IS NOT NULL");
                    }
                    if (!is_null($possible_values)) {
                        if (array_key_exists('mapping template', $field_args)) {
                            $possible_values = SFUtils::getLabelsFromTemplate($possible_values, $field_args['mapping template']);
                        } elseif (array_key_exists('mapping property', $field_args)) {
                            $possible_values = SFUtils::getLabelsFromProperty($possible_values, $field_args['mapping property']);
                        } elseif (array_key_exists('mapping cargo table', $field_args) && array_key_exists('mapping cargo field', $field_args)) {
                            $possible_values = SFUtils::getLabelsFromCargoField($possible_values, $field_args['mapping cargo table'], $field_args['mapping cargo field']);
                        }
                    }
                    // Backwards compatibility
                    if ($input_type == 'datetime with timezone') {
                        $input_type = 'datetime';
                        $field_args['include timezone'] = true;
                    } elseif ($input_type == 'text' || $input_type == 'textarea') {
                        // Also for backwards compatibility,
                        // in that once b/c goes away,
                        // this will no longer be
                        // necessary.
                        $field_args['no autocomplete'] = true;
                    }
                    if ($allow_multiple) {
                        $field_args['part_of_multiple'] = $allow_multiple;
                    }
                    if (count($show_on_select) > 0) {
                        $field_args['show on select'] = $show_on_select;
                    }
                    // Get the value from the request, if
                    // it's there, and if it's not an array.
                    $cur_value = null;
                    $escaped_field_name = str_replace("'", "\\'", $field_name);
                    if (isset($template_instance_query_values) && $template_instance_query_values != null && is_array($template_instance_query_values)) {
开发者ID:Rikuforever,项目名称:wiki,代码行数:67,代码来源:SF_FormPrinter.php


注:本文中的SFUtils::getValuesForCargoField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。