本文整理汇总了PHP中elgg_view_field函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_view_field函数的具体用法?PHP elgg_view_field怎么用?PHP elgg_view_field使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_view_field函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elgg_view_field
<?php
echo elgg_view_field(['#type' => 'text', 'name' => 'sitename', '#label' => elgg_echo('installation:sitename'), 'value' => elgg_get_config('sitename')]);
echo elgg_view_field(['#type' => 'text', 'name' => 'sitedescription', '#label' => elgg_echo('installation:sitedescription'), 'value' => elgg_get_config('sitedescription')]);
echo elgg_view_field(['#type' => 'email', 'name' => 'siteemail', '#label' => elgg_echo('installation:siteemail'), 'value' => elgg_get_site_entity()->email, 'class' => 'elgg-input-text']);
echo elgg_view_field(['#type' => 'number', 'name' => 'default_limit', '#label' => elgg_echo('installation:default_limit'), 'value' => elgg_get_config('default_limit'), 'min' => 1, 'step' => 1]);
echo elgg_view_field(['#type' => 'select', 'name' => 'language', '#label' => elgg_echo('installation:language'), 'value' => elgg_get_config('language'), 'options_values' => get_installed_translations()]);
$footer = elgg_view('input/submit', ['value' => elgg_echo('save')]);
elgg_set_form_footer($footer);
示例2: elgg_extract
<?php
/**
* Used to show plugin settings for both users and admins.
*
* @package Elgg.Core
* @subpackage Plugins
*/
$plugin = elgg_extract('entity', $vars);
$plugin_id = $plugin->getID();
$user_guid = elgg_extract('user_guid', $vars, elgg_get_logged_in_user_guid());
// Do we want to show admin settings or user settings
$type = elgg_extract('type', $vars, '');
if ($type != 'user') {
$type = '';
}
if (elgg_view_exists("plugins/{$plugin_id}/{$type}settings")) {
echo elgg_view("plugins/{$plugin_id}/{$type}settings", $vars);
}
echo elgg_view_field(['#type' => 'hidden', 'name' => 'plugin_id', 'value' => $plugin_id]);
echo elgg_view_field(['#type' => 'hidden', 'name' => 'user_guid', 'value' => $user_guid]);
$footer = elgg_view_field(['#type' => 'submit', 'value' => elgg_echo('save')]);
elgg_set_form_footer($footer);
示例3: elgg_extract
/**
* Widget edit num_display
*
* @uses $vars['entity'] ElggWidget
* @uses $vars['name'] (optional) The name of the attribute, defaults to 'num_display'
* @uses $vars['default'] (optional) The default value if no value is set, defaults to first option
*/
$widget = elgg_extract('entity', $vars);
if (!$widget instanceof \ElggWidget) {
return;
}
unset($vars['widget']);
$name = elgg_extract('name', $vars, 'num_display');
$vars['name'] = "params[{$name}]";
if (!isset($vars['label'])) {
$vars['label'] = elgg_echo('widget:numbertodisplay');
}
$vars['#label'] = $vars['label'];
unset($vars['label']);
if (!isset($vars['options'])) {
$vars['options'] = [5, 8, 10, 12, 15, 20];
}
$value = sanitize_int($widget->{$name}, false);
if (!$value) {
$value = elgg_extract('default', $vars, $vars['options'][0]);
}
$vars['value'] = $value;
$vars['#type'] = 'select';
echo elgg_view_field($vars);
示例4: elgg_extract
<?php
/**
* Elgg log rotator plugin settings.
*
* @package ElggLogRotate
*/
$plugin = elgg_extract('entity', $vars);
echo elgg_view_field(['#type' => 'select', '#label' => elgg_echo('logrotate:period'), 'name' => 'params[period]', 'options_values' => ['weekly' => elgg_echo('interval:weekly'), 'monthly' => elgg_echo('interval:monthly'), 'yearly' => elgg_echo('interval:yearly')], 'value' => $plugin->period]);
echo elgg_view_field(['#type' => 'select', '#label' => elgg_echo('logrotate:delete'), 'name' => 'params[delete]', 'options_values' => ['weekly' => elgg_echo('logrotate:week'), 'monthly' => elgg_echo('logrotate:month'), 'yearly' => elgg_echo('logrotate:year'), 'never' => elgg_echo('logrotate:never')], 'value' => $plugin->delete]);
示例5: elgg_view
if (!empty($value)) {
$value .= ', ';
}
$value .= $md->value;
$access_id = $md->access_id;
}
} else {
$value = $metadata->value;
$access_id = $metadata->access_id;
}
} else {
$value = '';
$access_id = ACCESS_DEFAULT;
}
// sticky form values take precedence over saved ones
if (isset($sticky_values[$shortname])) {
$value = $sticky_values[$shortname];
}
if (isset($sticky_values['accesslevel'][$shortname])) {
$access_id = $sticky_values['accesslevel'][$shortname];
}
$id = "profile-{$shortname}";
$input = elgg_view("input/{$valtype}", ['name' => $shortname, 'value' => $value, 'id' => $id]);
$access_input = elgg_view('input/access', ['name' => "accesslevel[{$shortname}]", 'value' => $access_id]);
echo elgg_view('elements/forms/field', ['input' => $input . $access_input, 'label' => elgg_view('elements/forms/label', ['label' => elgg_echo("profile:{$shortname}"), 'id' => $id])]);
}
}
elgg_clear_sticky_form('profile:edit');
echo elgg_view('input/hidden', array('name' => 'guid', 'value' => $entity->guid));
echo elgg_view_field(['#type' => 'submit', 'value' => elgg_echo('save'), '#class' => 'elgg-foot']);
示例6: elgg_echo
$symlink_warning = '<p class="elgg-text-help">' . elgg_echo('installation:cache_symlink:description') . '</p>';
if ($cache_symlinked) {
$params['class'] = 'elgg-state-disabled';
$params['label_class'] = 'elgg-state-disabled';
$symlink_warning .= elgg_format_element('span', ['class' => 'elgg-text-help'], elgg_echo('installation:cache_symlink:warning'));
}
$symlink_input = elgg_view('input/checkbox', $params);
$symlink_source = elgg_get_root_path() . 'cache/';
$symlink_target = elgg_get_cache_path() . 'views_simplecache/';
$symlink_paths_help = elgg_echo('installation:cache_symlink:paths', [$symlink_source, $symlink_target]);
$symlink_warning .= elgg_format_element('span', ['class' => 'elgg-text-help'], $symlink_paths_help);
// minify
$minify_description = elgg_echo('installation:minify:description');
$minify_js_input = elgg_view("input/checkbox", array('label' => elgg_echo('installation:minify_js:label'), 'name' => 'simplecache_minify_js', 'checked' => (bool) elgg_get_config('simplecache_minify_js'), 'label_class' => $simple_cache_disabled_class, 'switch' => true));
$minify_css_input = elgg_view("input/checkbox", array('label' => elgg_echo('installation:minify_css:label'), 'name' => 'simplecache_minify_css', 'checked' => (bool) elgg_get_config('simplecache_minify_css'), 'label_class' => $simple_cache_disabled_class, 'switch' => true));
$system_cache_input = elgg_view_field(['#type' => 'checkbox', 'label' => elgg_echo('installation:systemcache:label'), 'help' => elgg_echo('installation:systemcache:description'), 'name' => 'system_cache_enabled', 'switch' => true, 'checked' => elgg_is_system_cache_enabled(), '#class' => 'mtm']);
$body = <<<BODY
\t<div>
\t\t{$simple_cache_input}
\t\t{$simple_cache_warning}
\t</div>
\t<div>
\t\t{$symlink_input}
\t\t{$symlink_warning}
\t</div>
\t<div>
\t\t<p>{$minify_description}</p>
\t\t{$minify_js_input}<br />
\t\t{$minify_css_input}
\t</div>
示例7: elgg_get_page_owner_entity
<?php
/**
* Provide a way of setting your default access
*
* @package Elgg
* @subpackage Core
*/
if (!elgg_get_config('allow_user_default_access')) {
return;
}
$user = elgg_get_page_owner_entity();
if (!$user instanceof ElggUser) {
return;
}
$default_access = $user->getPrivateSetting('elgg_default_access');
if ($default_access === null) {
$default_access = elgg_get_config('default_access');
}
$title = elgg_echo('default_access:settings');
$content = elgg_view_field(array('#type' => 'access', 'name' => 'default_access', 'value' => $default_access, '#label' => elgg_echo('default_access:label')));
echo elgg_view_module('info', $title, $content);
示例8: elgg_extract
<?php
/**
* Group activity widget settings
*/
$widget = elgg_extract('entity', $vars);
// once autocomplete is working use that
$groups = $widget->getOwnerEntity()->getGroups(['limit' => false]);
$mygroups = [];
if (!$widget->group_guid) {
$mygroups[0] = '';
}
foreach ($groups as $group) {
$mygroups[$group->guid] = $group->name;
}
echo elgg_view_field(['#type' => 'select', 'name' => 'params[group_guid]', '#label' => elgg_echo('groups:widget:group_activity:edit:select'), 'value' => $widget->group_guid, 'options_values' => $mygroups]);
// set default value
if (!isset($widget->num_display)) {
$widget->num_display = 8;
}
echo elgg_view('object/widget/edit/num_display', ['entity' => $widget]);
echo elgg_view('input/hidden', ['name' => 'title']);
示例9: elgg_require_js
<?php
/**
* Elgg login form
*
* @package Elgg
* @subpackage Core
*/
elgg_require_js('forms/login');
echo elgg_view_field(['#type' => 'text', 'name' => 'username', 'autofocus' => true, 'required' => true, '#label' => elgg_echo('loginusername')]);
echo elgg_view_field(['#type' => 'password', 'name' => 'password', 'required' => true, '#label' => elgg_echo('password')]);
echo elgg_view('login/extend', $vars);
if (isset($vars['returntoreferer'])) {
echo elgg_view_field(['#type' => 'hidden', 'name' => 'returntoreferer', 'value' => 'true']);
}
ob_start();
?>
<div class="elgg-foot">
<label class="mtm float-alt">
<input type="checkbox" name="persistent" value="true" />
<?php
echo elgg_echo('user:persistent');
?>
</label>
<?php
echo elgg_view('input/submit', array('value' => elgg_echo('login')));
echo elgg_view_menu('login', array('sort_by' => 'priority', 'class' => 'elgg-menu-general elgg-menu-hz mtm'));
?>
</div>
<?php
示例10: elgg_view_field
}
echo elgg_view_field(['#type' => 'access', '#label' => elgg_echo('groups:visibility'), 'name' => 'vis', 'id' => 'groups-vis', 'value' => $visibility, 'options_values' => $visibility_options, 'entity' => $entity, 'entity_type' => 'group', 'entity_subtype' => '']);
}
$access_mode_params = ['#type' => 'select', '#label' => elgg_echo('groups:content_access_mode'), 'name' => 'content_access_mode', 'id' => 'groups-content-access-mode', 'value' => $content_access_mode, 'options_values' => [ElggGroup::CONTENT_ACCESS_MODE_UNRESTRICTED => elgg_echo('groups:content_access_mode:unrestricted'), ElggGroup::CONTENT_ACCESS_MODE_MEMBERS_ONLY => elgg_echo('groups:content_access_mode:membersonly')]];
if ($entity) {
// Disable content_access_mode field for hidden groups because the setting
// will be forced to members_only regardless of the entered value
if ($entity->access_id === $entity->group_acl) {
$access_mode_params['disabled'] = 'disabled';
}
if ($entity->getContentAccessMode() == ElggGroup::CONTENT_ACCESS_MODE_UNRESTRICTED) {
// Warn the user that changing the content access mode to more
// restrictive will not affect the existing group content
$access_mode_params['#help'] = elgg_echo('groups:content_access_mode:warning');
}
}
echo elgg_view_field($access_mode_params);
if ($entity && ($owner_guid == elgg_get_logged_in_user_guid() || elgg_is_admin_logged_in())) {
$members = [];
$dbprefix = elgg_get_config('dbprefix');
$batch = new ElggBatch('elgg_get_entities_from_relationship', ['type' => 'user', 'relationship' => 'member', 'relationship_guid' => $entity->getGUID(), 'inverse_relationship' => true, 'limit' => false, 'callback' => false, 'joins' => ["JOIN {$dbprefix}users_entity ue ON e.guid = ue.guid"], 'selects' => ['ue.*'], 'order_by' => 'ue.name ASC']);
foreach ($batch as $member) {
$option_text = "{$member->name} (@{$member->username})";
$members[$member->guid] = htmlspecialchars($option_text, ENT_QUOTES, "UTF-8", false);
}
$owner_guid_options = ['#type' => 'select', '#label' => elgg_echo('groups:owner'), 'name' => 'owner_guid', 'id' => 'groups-owner-guid', 'value' => $owner_guid, 'options_values' => $members, 'class' => 'groups-owner-input'];
if ($owner_guid == elgg_get_logged_in_user_guid()) {
$owner_guid_options['#help'] = elgg_echo('groups:owner:warning');
}
echo elgg_view_field($owner_guid_options);
}
示例11: elgg_view_field
<?php
/**
* Advanced site settings, system section.
*/
$body = elgg_view_field(['#type' => 'text', 'name' => 'wwwroot', '#label' => elgg_echo('installation:wwwroot'), 'value' => elgg_get_config('wwwroot')]);
$body .= elgg_view_field(['#type' => 'text', 'name' => 'path', '#label' => elgg_echo('installation:path'), 'value' => elgg_get_config('path')]);
$dataroot_in_settings = !empty($GLOBALS['_ELGG']->dataroot_in_settings);
$body .= elgg_view_field(['#type' => 'text', 'name' => 'dataroot', '#label' => elgg_echo('installation:dataroot'), 'value' => elgg_get_config('dataroot'), 'readonly' => $dataroot_in_settings, 'class' => $dataroot_in_settings ? 'elgg-state-disabled' : '', '#help' => $dataroot_in_settings ? elgg_echo('admin:settings:in_settings_file') : '']);
echo elgg_view_module('inline', elgg_echo('admin:legend:system'), $body, ['id' => 'elgg-settings-advanced-system']);
示例12: elgg_echo
<?php
/**
* Advanced site settings, content access section.
*/
$field = ['#type' => 'access', 'options_values' => [ACCESS_PRIVATE => elgg_echo('PRIVATE'), ACCESS_FRIENDS => elgg_echo('access:friends:label'), ACCESS_LOGGED_IN => elgg_echo('LOGGED_IN'), ACCESS_PUBLIC => elgg_echo('PUBLIC')], 'name' => 'default_access', '#label' => elgg_echo('installation:sitepermissions'), '#help' => elgg_echo('admin:site:access:warning'), 'value' => elgg_get_config('default_access')];
if (!elgg_is_active_plugin('friends')) {
unset($field['options_values'][ACCESS_FRIENDS]);
}
$body = elgg_view_field($field);
$body .= elgg_view_field(['#type' => 'checkbox', 'label' => elgg_echo('installation:allow_user_default_access:label'), '#help' => elgg_echo('installation:allow_user_default_access:description'), 'name' => 'allow_user_default_access', 'checked' => (bool) elgg_get_config('allow_user_default_access')]);
echo elgg_view_module('inline', elgg_echo('admin:legend:content_access'), $body, ['id' => 'elgg-settings-advanced-content-access']);
示例13: elgg_view_input
/**
* Renders a form field
*
* @param string $input_type Input type, used to generate an input view ("input/$input_type")
* @param array $vars Fields and input vars.
* Field vars contain both field and input params. 'label', 'help',
* and 'field_class' params will not be passed on to the input view.
* Others, including 'required' and 'id', will be available to the
* input view. Both 'label' and 'help' params accept HTML, and
* will be printed unescaped within their wrapper element.
* @return string
*
* @since 2.1
* @deprecated 2.3 Use elgg_view_field()
*/
function elgg_view_input($input_type, array $vars = array())
{
elgg_deprecated_notice(__FUNCTION__ . '() is deprecated. Use elgg_view_field()', '2.3');
$vars['#type'] = $input_type;
if (isset($vars['label']) && $input_type !== 'checkbox') {
$vars['#label'] = $vars['label'];
unset($vars['label']);
}
if (isset($vars['help'])) {
$vars['#help'] = $vars['help'];
unset($vars['help']);
}
if (isset($vars['field_class'])) {
$vars['#class'] = $vars['field_class'];
unset($vars['field_class']);
}
return elgg_view_field($vars);
}
示例14: elgg_extract_class
* @uses $vars['align'] Field alignment (vertical|horizontal)
* If set to horizontal, fields will be rendered
* with inline display
* @uses $vars['justify'] Text justification (left|right|center)
* @uses $vars['legend'] Optional fieldset legend
* @uses $vars['fields'] An array of field options
* Field options should be suitable for use in
* elgg_view_field()
*/
$vars['class'] = elgg_extract_class($vars, ['elgg-fieldset', 'clearfix']);
$align = elgg_extract('align', $vars, 'vertical');
unset($vars['align']);
$vars['class'][] = "elgg-fieldset-{$align}";
$justify = elgg_extract('justify', $vars, '');
unset($vars['justify']);
if ($justify) {
$vars['class'][] = "elgg-justify-{$justify}";
}
$legend = elgg_extract('legend', $vars);
unset($vars['legend']);
$fields = (array) elgg_extract('fields', $vars, []);
unset($vars['fields']);
$fieldset = '';
if ($legend) {
$vars['class'] = 'elgg-fieldset-has-legend';
$fieldset .= elgg_format_element('legend', [], $legend);
}
foreach ($fields as $field) {
$fieldset .= elgg_view_field($field);
}
echo elgg_format_element('fieldset', $vars, $fieldset);
示例15: elgg_extract
<?php
/**
* Discussion topic reply form body
*
* @uses $vars['topic'] A discussion topic object
* @uses $vars['entity'] A discussion reply object
* @uses $vars['inline'] Display a shortened form?
*/
$topic = elgg_extract('topic', $vars);
$reply = elgg_extract('entity', $vars);
$inline = elgg_extract('inline', $vars, false);
echo elgg_view_field(['#type' => 'hidden', 'name' => 'topic_guid', 'value' => $topic ? $topic->guid : '']);
echo elgg_view_field(['#type' => 'hidden', 'name' => 'guid', 'value' => $reply ? $reply->guid : '']);
if ($reply) {
$label = elgg_echo('discussion:reply:edit');
$value = $reply->description;
$action = elgg_echo('save');
} else {
$label = elgg_echo('reply:this');
$value = '';
$action = elgg_echo('reply');
}
echo elgg_view_field(['#type' => 'longtext', '#label' => $label, 'name' => 'description', 'value' => $value, 'visual' => !$inline, 'editor_type' => 'simple']);
$buttons = [['#type' => 'submit', 'value' => $action]];
if ($inline) {
$buttons[] = ['#type' => 'button', 'type' => 'reset', 'text' => elgg_echo('cancel'), 'class' => 'elgg-button-cancel'];
}
$footer = elgg_view_field(['#type' => 'fieldset', 'fields' => $buttons, 'align' => 'horizontal']);
elgg_set_form_footer($footer);