本文整理汇总了PHP中FormUI::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP FormUI::remove方法的具体用法?PHP FormUI::remove怎么用?PHP FormUI::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormUI
的用法示例。
在下文中一共展示了FormUI::remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
}