本文整理汇总了PHP中FormUI::move_after方法的典型用法代码示例。如果您正苦于以下问题:PHP FormUI::move_after方法的具体用法?PHP FormUI::move_after怎么用?PHP FormUI::move_after使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormUI
的用法示例。
在下文中一共展示了FormUI::move_after方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_form_publish
/**
* Add additional controls to the publish page tab
*
* @param FormUI $form The form that is used on the publish page
* @param Post $post The post being edited
**/
public function action_form_publish($form, $post)
{
switch ($post->content_type) {
case Post::type('entry'):
$extra = $form->append('textarea', 'extra_textarea', 'null:null', _t('Extra', 'extra_content'));
$extra->value = $post->info->extra;
$extra->class[] = 'resizable';
$extra->rows = 3;
$extra->template = 'admincontrol_textarea';
$form->move_after($form->extra_textarea, $form->content);
break;
default:
return;
}
}
示例2: action_form_user
/**
* Add additional controls to the User page
*
* @param FormUI $form The form that is used on the User page
* @param Post $post The user being edited
**/
public function action_form_user($form, $edit_user)
{
$fields = Options::get('userfields__fields');
if (!is_array($fields) || count($fields) == 0) {
return;
}
$userfields = $form->append('wrapper', 'userfields', 'User Fields');
$userfields->class = 'container settings';
$userfields->append('static', 'userfields', _t('<h2>Additional fields</h2>'));
foreach ($fields as $field) {
$fieldname = "userfield_{$field}";
$customfield = $userfields->append('text', $fieldname, 'null:null', $field);
$customfield->value = isset($edit_user->info->{$fieldname}) ? $edit_user->info->{$fieldname} : '';
$customfield->class[] = 'important item clear';
$customfield->template = 'optionscontrol_text';
}
$form->move_after($userfields, $form->user_info);
}
示例3: form_publish_addon
/**
* Manipulate the controls on the publish page for Addons
*
* @todo fix tab indexes
* @todo remove settings tab without breaking everything in it?
*
* @param FormUI $form The form that is used on the publish page
* @param Post $post The post that's being edited
*/
private function form_publish_addon($form, $post)
{
// remove the settings pane from the publish controls for non-admin users, we don't want anyone editing that
if (User::identify()->can('superuser') == false) {
$form->publish_controls->remove($form->publish_controls->settings);
}
// add guid after title
$guid = $form->append(FormControlText::create('guid', new ControlStorage(function ($name) use($post) {
return $post->info->guid;
}, function ($name, $value) use($post) {
$post->info->guid = $value;
}))->label(_t('GUID', 'addon_catalog')));
$form->move_after($guid, $form->label_for_title);
// position it after the title
// add the description after the guid
$description = $form->append(FormControlTextArea::create('description', $post, array('rows' => 2))->label(_t('Description', 'addon_catalog')));
$form->move_after($description, $guid);
// add the instructions after the content
$instructions = $form->append(FormControlTextArea::create('instructions')->add_class('resizable')->set_properties(array('rows' => 4))->label(_t('Instructions', 'addon_catalog')));
$form->move_after($instructions, $form->label_for_content);
// position it after the content box
// create the addon details wrapper pane
$addon_fields = $form->append(FormControlFieldset::create('addon_details')->set_caption(_t('Details', 'addon_catalog')));
$form->move_after($addon_fields, $form->label_for_tags);
// add the type: plugin or theme
$details_type = $addon_fields->append(FormControlSelect::create('type', $post)->set_options($this->_types)->add_validator('validate_required')->label(_t('Addon Type', 'addon_catalog')));
// add the url
$details_url = $addon_fields->append(FormControlText::create('url', $post)->label(_t('URL', 'addon_catalog')));
// add the screenshot
$details_screenshot = $addon_fields->append(FormControlText::create('screenshot_url', $post)->label(_t('Screenshot', 'addon_catalog')));
}
示例4: action_form_publish
/**
*Manipulate the controls on the publish page
*
*@param FormUI $form The form that is used on the publish page
*@param Post $post The post being edited
**/
public function action_form_publish($form, $post)
{
if ($form->content_type->value == Post::type('plugin')) {
// remove silos we don't need them, do we?
$form->remove($form->silos);
// add guid after title
$guid = $form->append('text', 'plugin_details_guid', 'null:null', 'GUID');
$guid->value = $post->info->guid;
$guid->template = $post->slug ? 'admincontrol_text' : 'guidcontrol';
$form->move_after($form->plugin_details_guid, $form->title);
// add instructions after content
$instructions = $form->append('textarea', 'plugin_details_instructions', 'null:null', 'Instructions');
$instructions->value = $post->info->instructions;
$instructions->class[] = 'resizable';
$instructions->template = 'admincontrol_textarea';
$form->move_after($form->plugin_details_instructions, $form->content);
// todo Fix all the tabindexes - there are two #2s right now and GUID has none.
// todo Remove the settings tab, as it's not needed
$plugin_details = array('url' => $post->info->url, 'screenshot' => $post->info->screenshot, 'author' => $post->info->author, 'author_url' => $post->info->author_url, 'license' => $post->info->license);
$plugin_form_fields = $form->publish_controls->append('fieldset', 'plugin_details', 'Plugin Details');
foreach ($plugin_details as $field => $value) {
$plugin_field = $plugin_form_fields->append('text', 'plugin_details_' . $field, 'null:null', ucfirst(str_replace('_', ' ', $field)));
$plugin_field->value = $value;
$plugin_field->template = 'tabcontrol_text';
}
$plugin_versions = $form->publish_controls->append('fieldset', 'plugin_versions', 'Plugin Versions');
if ($post->slug != '') {
$form->plugin_versions->append('static', 'current_versions', 'Current Versions');
foreach ((array) $post->versions as $version) {
$version_info = $version->status . ": " . $post->title . " " . $version->version . " -- " . $version->description;
$plugin_versions->append('static', 'version_info', $version_info);
}
}
$form->plugin_versions->append('static', 'new_version', 'Add New Version');
$version = $plugin_versions->append('text', 'plugin_version_version', 'null:null', _t('Version Number'));
$version->template = 'tabcontrol_text';
$description = $plugin_versions->append('text', 'plugin_version_description', 'null:null', _t('Version Description'));
$description->template = 'tabcontrol_text';
$url = $plugin_versions->append('text', 'plugin_version_url', 'null:null', _t('Archive URL'));
$url->template = 'tabcontrol_text';
$habari_version = $plugin_versions->append('text', 'plugin_version_habari_version', 'null:null', _t('Compatible Habari Version <br> ("x" is a wildcard, eg. 0.5.x)'));
$habari_version->template = 'tabcontrol_text';
$status = $plugin_versions->append('select', 'plugin_version_status', 'null:null', 'Status');
$status->template = 'tabcontrol_select';
$status->options = array('release' => 'Release', 'critical' => 'Critical', 'bugfix' => 'Bugfix', 'feature' => 'Feature');
$requires = $plugin_versions->append('text', 'plugin_version_requires', 'null:null', _t('Requires'));
$requires->template = 'tabcontrol_text';
$provides = $plugin_versions->append('text', 'plugin_version_provides', 'null:null', _t('Provides'));
$provides->template = 'tabcontrol_text';
$recommends = $plugin_versions->append('text', 'plugin_version_recommends', 'null:null', _t('Recommends'));
$recommends->template = 'tabcontrol_text';
$sourcelink = $plugin_versions->append('text', 'plugin_version_source_link', 'null:null', _t('Link to Source'));
$sourcelink->template = 'tabcontrol_text';
/* @todo validate sourcelink */
} else {
if ($form->content_type->value == Post::type('license')) {
// clean up the form a little...
$form->remove($form->silos);
$form->remove($form->content);
$form->remove($form->tags);
$settings = $form->publish_controls->settings;
$settings->minor_edit->remove();
$settings->comments_enabled->remove();
$settings->pubdate->remove();
// add shortname after title
$shortname = $form->append('text', 'license_shortname', 'null:null', _t('Short Name'));
$shortname->value = $post->info->shortname;
$shortname->template = 'admincontrol_text';
$form->move_after($form->license_shortname, $form->title);
// add simpletext after shortname
$simpletext = $form->append('textarea', 'license_simpletext', 'null:null', _t('Simplified Text'));
$simpletext->value = $post->info->simpletext;
$simpletext->class[] = 'resizable';
$simpletext->template = 'admincontrol_textarea';
$form->move_after($form->license_simpletext, $form->license_shortname);
// add link after simpletext
$link = $form->append('text', 'license_link', 'null:null', _t('Link'));
$link->value = $post->info->link;
$link->template = 'admincontrol_text';
$form->move_after($form->license_link, $form->license_simpletext);
}
}
}