本文整理汇总了PHP中FormUI::set_option方法的典型用法代码示例。如果您正苦于以下问题:PHP FormUI::set_option方法的具体用法?PHP FormUI::set_option怎么用?PHP FormUI::set_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormUI
的用法示例。
在下文中一共展示了FormUI::set_option方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_theme_ui
/**
* Configuration form for the Charcoal theme
**/
public function action_theme_ui($theme)
{
$ui = new FormUI(__CLASS__);
// This is a fudge as I only need to add a little bit of styling to make things look nice.
$ui->append('static', 'style', '<style type="text/css">#charcoal .formcontrol { line-height: 2.2em; }</style>');
$ui->append('checkbox', 'show_title_image', __CLASS__ . '__show_title_image', _t('Show Title Image:'), 'optionscontrol_checkbox');
$ui->show_title_image->helptext = _t('Check to show the title image, uncheck to display the title text.');
$ui->append('text', 'home_label', __CLASS__ . '__home_label', _t('Home label:'), 'optionscontrol_text');
$ui->home_label->helptext = _t('Set to whatever you want your first tab text to be.');
$ui->append('checkbox', 'show_entry_paperclip', __CLASS__ . '__show_entry_paperclip', _t('Show Entry Paperclip:'), 'optionscontrol_checkbox');
$ui->show_entry_paperclip->helptext = _t('Check to show the paperclip graphic in posts, uncheck to hide it.');
$ui->append('checkbox', 'show_page_paperclip', __CLASS__ . '__show_page_paperclip', _t('Show Page Paperclip:'), 'optionscontrol_checkbox');
$ui->show_page_paperclip->helptext = _t('Check to show the paperclip graphic in pages, uncheck to hide it.');
$ui->append('checkbox', 'show_powered', __CLASS__ . '__show_powered', _t('Show Powered By:'), 'optionscontrol_checkbox');
$ui->show_powered->helptext = _t('Check to show the "powered by Habari" graphic in the sidebar, uncheck to hide it.');
$ui->append('checkbox', 'display_login', __CLASS__ . '__display_login', _t('Display Login:'), 'optionscontrol_checkbox');
$ui->display_login->helptext = _t('Check to show the Login/Logout link in the navigation bar, uncheck to hide it.');
$ui->append('checkbox', 'tags_in_multiple', __CLASS__ . '__tags_in_multiple', _t('Tags in Multiple Posts Page:'), 'optionscontrol_checkbox');
$ui->tags_in_multiple->helptext = _t('Check to show the post tags in the multiple posts pages (search, tags, archives), uncheck to hide them.');
$ui->append('checkbox', 'show_post_nav', __CLASS__ . '__show_post_nav', _t('Show Post Navigation:'), 'optionscontrol_checkbox');
$ui->show_post_nav->helptext = _t('Set to true to show single post navigation links, false to hide them.');
$ui->append('text', 'tags_count', __CLASS__ . '__tags_count', _t('Tag Cloud Count:'), 'optionscontrol_text');
$ui->tags_count->helptext = _t('Set to the number of tags to display on the default "cloud".');
// Save
$ui->append('submit', 'save', _t('Save'));
$ui->set_option('success_message', _t('Options saved'));
$ui->out();
}
示例2: action_plugin_ui
/**
* Respond to the user selecting an action on the plugin page
* @param string $plugin_id The string id of the acted-upon plugin
* @param string $action The action string supplied via the filter_plugin_config hook
**/
public function action_plugin_ui($plugin_id, $action)
{
if ($plugin_id === $this->plugin_id()) {
switch ($action) {
case _t('Configure', $this->class_name):
$ui = new FormUI($this->class_name);
$type = $ui->append('select', 'type', 'option:' . $this->class_name . '__type', _t('Photostream Type', $this->class_name));
$type->options = array('public' => _t('Public photos & video', $this->class_name), 'user' => _t('Public photos & video from you', $this->class_name), 'friends' => _t('Your friends’ photostream', $this->class_name), 'faves' => _t('Public favorites from you', $this->class_name), 'group' => _t('Group pool', $this->class_name));
$type->add_validator('validate_required');
$user_id = $ui->append('text', 'user_id', 'option:' . $this->class_name . '__user_id', _t('Flickr ID (You can get it from <a href="http://idgettr.com">idGettr</a>)', $this->class_name));
$user_id->add_validator('validate_flickr_id');
$num_item = $ui->append('text', 'num_item', 'option:' . $this->class_name . '__num_item', _t('№ of Photos', $this->class_name));
$num_item->add_validator('validate_uint');
$num_item->add_validator('validate_required');
$size = $ui->append('select', 'size', 'option:' . $this->class_name . '__size', _t('Photo Size', $this->class_name));
$size->options = array('square' => _t('Square', $this->class_name), 'thumbnail' => _t('Thumbnail', $this->class_name), 'small' => _t('Small', $this->class_name), 'medium' => _t('Medium', $this->class_name), 'large' => _t('Large', $this->class_name), 'original' => _t('Original', $this->class_name));
$size->add_validator('validate_required');
$tags = $ui->append('text', 'tags', 'option:' . $this->class_name . '__tags', _t('Tags (comma separated, no space)', $this->class_name));
$cache_expiry = $ui->append('text', 'cache_expiry', 'option:' . $this->class_name . '__cache_expiry', _t('Cache Expiry (in seconds)', $this->class_name));
$cache_expiry->add_validator('validate_uint');
$cache_expiry->add_validator('validate_required');
// When the form is successfully completed, call $this->updated_config()
$ui->append('submit', 'save', _t('Save', $this->class_name));
$ui->set_option('success_message', _t('Options saved', $this->class_name));
$ui->out();
break;
}
}
}
示例3: get_form
public function get_form($group = null)
{
if ($group == null) {
$group = Options::get('register__group');
if ($group == null) {
$group = 'anonymous';
}
}
$form = new FormUI('registration');
$form->class[] = 'registration';
$form->append('text', 'email', 'null:null', _t('Email', __CLASS__), 'formcontrol_text');
$form->email->add_validator('validate_email');
$form->append('text', 'username', 'null:null', _t('Username', __CLASS__), 'formcontrol_text');
$form->username->add_validator('validate_required');
$form->username->add_validator('validate_username');
$form->append('password', 'password', 'null:null', _t('Password', __CLASS__), 'formcontrol_password');
$form->password->add_validator('validate_required');
$form->append('password', 'password_confirmation', 'null:null', _t('Confirm Password', __CLASS__), 'formcontrol_password');
$form->password_confirmation->add_validator('validate_required');
$form->password_confirmation->add_validator('validate_same', $form->password);
// Store the group to be added. This is stored locally, not retrieved from unsafe data.
$form->set_option('group_name', $group);
// Create the Register button
$form->append('submit', 'register', _t('Register', __CLASS__), 'formcontrol_submit');
$form->on_success(array($this, 'register_user'));
// Return the form object
return $form;
}
示例4: configure
public function configure()
{
$form = new FormUI('slugsync');
$form->append('checkbox', 'draft_updates', 'slugsync__draftupdates', _t('Only update when post status is draft: ', 'slugsync'));
$form->append('submit', 'save', 'Save');
$form->set_option('success_message', _t('Slugsync options saved.', 'slugsync'));
return $form;
}
示例5: configure
public function configure()
{
$ui = new FormUI(strtolower(get_class($this)));
$css_location = $ui->append('text', 'css_location', 'option:freestyleadmin__css_location', _t('FreeStyle CSS Location', 'FreeStyleAdmin'));
$css_location->add_validator('validate_required');
$ui->append('submit', 'save', _t('Save', 'FreeStyleAdmin'));
$ui->set_option('success_message', _t('Configuration saved', 'FreeStyleAdmin'));
return $ui;
}
示例6: configure
public function configure()
{
$form = new FormUI('preapproved');
$form->append('text', 'approved_count', 'option:preapproved__approved_count', _t('Required number of approved comments: '));
$form->approved_count->add_validator(array($this, 'validate_integer'));
$form->append('submit', 'save', _t('Save'));
$form->set_option('success_message', _t('Configuration saved'));
$form->out();
}
示例7: configure
public function configure()
{
$form = new FormUI('threaded_comment');
$depth = $form->append('text', 'threaded_depth', 'threaded_comment__depth', _t('Max depth of thread:'));
$depth->add_validator('validate_regex', '/^[0-9]*$/', _t('Please enter a valid positive integer.'));
$form->append('submit', 'save', _t('Save'));
$form->set_option('success_message', _t('Configuration saved'));
return $form;
}
示例8: action_plugin_ui_configure
public function action_plugin_ui_configure()
{
$ui = new FormUI('autoclose');
$age_in_days = $ui->append('text', 'age_in_days', 'autoclose__age_in_days', _t('Post age (days) for autoclose', 'autoclose'));
$age_in_days->add_validator('validate_required');
$ui->append('submit', 'save', _t('Save', 'autoclose'));
$ui->set_option('success_message', _t('Configuration saved', 'autoclose'));
$ui->on_success(array($this, 'updated_config'));
$ui->out();
}
示例9: action_theme_ui
/**
* Respond to the user selecting an action on the theme page
*/
public function action_theme_ui($theme)
{
$ui = new FormUI(strtolower(get_class($this)));
$ui->append('text', 'home_tab', 'option:' . $this->class_name . '__home_tab', _t('Link Text to Home'));
$ui->home_tab->add_validator('validate_required');
$ui->append('checkbox', 'show_author', 'option:' . $this->class_name . '__show_author', _t('Display author in posts'));
// Save
$ui->append('submit', 'save', _t('Save'));
$ui->set_option('success_message', _t('Options saved'));
$ui->out();
}
示例10: get_form
public function get_form()
{
$users = Users::get_all();
$users = Utils::array_map_field($users, 'username', 'id');
$form = new FormUI('sudo');
$form->append(new FormControlSelect('userlist', 'null:null', 'Become User:', $users));
$form->userlist->value = User::identify()->id;
$form->append(new FormControlSubmit('submit', 'Submit'));
$form->set_option('form_action', URL::get('sudo'));
$form->onsubmit = 'return dosudo.setuser();';
return $form;
}
示例11: action_theme_ui
/**
* Respond to the user selecting 'configure' on the themes page
*
*/
public function action_theme_ui()
{
$form = new FormUI('simplerer_theme');
$copyright_notice = $form->append('text', 'copyright_notice', 'simplerer__copyright_notice', _t('Copyright Notice'));
$copyright_notice->template = 'optionscontrol_text';
$copyright_notice->class = 'clear';
$copyright_notice->raw = true;
$copyright_notice->helptext = _t('Use %year to substitute in the current year.');
$form->append('submit', 'save', 'Save');
$form->set_option('success_message', _t('Theme Settings Updated'));
$form->out();
}
示例12: action_theme_ui
public function action_theme_ui($theme)
{
$ui = new FormUI(__CLASS__);
// Potential Static home page
$page = $ui->append('select', 'page', 'criticalhit__home', _t('The page to show for the home page: ', 'staticfront'));
$page->options['--none--'] = _t('Show Normal Posts', 'staticfront');
foreach (Posts::get(array('content_type' => Post::type('page'), 'nolimit' => 1)) as $post) {
$page->options[$post->slug] = $post->title;
}
// Save
$ui->append('submit', 'save', _t('Save'));
$ui->set_option('success_message', _t('Options saved'));
$ui->out();
}
示例13: action_plugin_ui
public function action_plugin_ui($plugin_id, $action)
{
if ($plugin_id == $this->plugin_id()) {
switch ($action) {
case _t('Configure'):
$ui = new FormUI(strtolower(get_class($this)));
$ui->append('text', 'username', 'gallr__username', _t('User ID:'));
$ui->append('submit', 'save', _t('Save'));
$ui->set_option('success_message', _t('Options saved'));
$ui->out();
break;
}
}
}
示例14: action_plugin_ui
/**
* Respond to the user selecting an action on the plugin page
* @param string $plugin_id The string id of the acted-upon plugin
* @param string $action The action string supplied via the filter_plugin_config hook
**/
public function action_plugin_ui($plugin_id, $action)
{
if ($plugin_id === $this->plugin_id()) {
switch ($action) {
case _t('Configure', $this->class_name):
$ui = new FormUI($this->class_name);
$ui->append('select', 'color_scheme', 'option:' . $this->class_name . '__color_scheme', _t('Color Scheme', $this->class_name), self::get_color_schemes());
// When the form is successfully completed, call $this->updated_config()
$ui->append('submit', 'save', _t('Save', $this->class_name));
$ui->set_option('success_message', _t('Options saved', $this->class_name));
$ui->out();
break;
}
}
}
示例15: action_plugin_ui
public function action_plugin_ui($plugin_id, $action)
{
if ($plugin_id == $this->plugin_id()) {
switch ($action) {
case _t('Configure'):
$ui = new FormUI(strtolower(get_class($this)));
$technorati_apikey = $ui->append('text', 'apikey', 'option:technorati__apikey', _t('Technorati API Key (Get it from ') . '<a href="http://www.technorati.com/developers/apikey.html">' . _t('Developer Center') . '</a>)');
$technorati_apikey->add_validator('validate_required');
$ui->append('submit', 'save', _t('Save'));
$ui->set_option('success_message', _t('Configuration saved'));
$ui->out();
break;
}
}
}