本文整理汇总了PHP中Options::set_group方法的典型用法代码示例。如果您正苦于以下问题:PHP Options::set_group方法的具体用法?PHP Options::set_group怎么用?PHP Options::set_group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::set_group方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_theme_activated
/**
* On theme activation, set the default options and activate a default menu
*/
public function action_theme_activated()
{
$opts = Options::get_group(__CLASS__);
if (empty($opts)) {
Options::set_group(__CLASS__, $this->defaults);
}
$blocks = $this->get_blocks('nav', 0, $this);
if (count($blocks) == 0) {
$block = new Block(array('title' => _t('Charcoal Menu'), 'type' => 'charcoal_menu'));
$block->add_to_area('nav');
Session::notice(_t('Added Charcoal Menu block to Nav area.'));
}
}
示例2: action_plugin_activation
function action_plugin_activation($file)
{
if (Plugins::id_from_file($file) == Plugins::id_from_file(__FILE__)) {
Options::set_group('recaptcha', array('public_key' => '', 'private_key' => '', 'theme' => 'red'));
}
}
示例3: action_theme_ui
/**
* function action_theme_ui
* Create and display the Theme configuration
**/
public function action_theme_ui()
{
$opts = Options::get_group( __CLASS__ );
if ( empty( $opts ) ) {
Options::set_group( __CLASS__, $this->defaults );
}
$controls = array();
$controls['home_label'] = array(
'label' => _t('Home tab label:'),
'type' => 'text'
);
$controls['login_display_location'] = array(
'label' => _t('Login display:'),
'type' => 'select',
'options' => array(
'nowhere' => _t( 'Nowhere' ),
'header' => _t( 'As a navigation tab' ),
'sidebar' => _t( 'In the sidebar' )
)
);
$controls['show_author'] = array(
'label' => _t( 'Display author:' ),
'type' => 'checkbox',
);
$ui = new FormUI( strtolower( get_class( $this ) ) );
$wrapper = $ui->append( 'wrapper', 'k2config', 'k2config' );
$wrapper->class = "settings clear";
foreach ( $controls as $option_name => $option ) {
$field = $wrapper->append( $option['type'], $option_name, __CLASS__. '__' . $option_name, $option['label'] );
$field->template = 'optionscontrol_' . $option['type'];
$field->class = "item clear";
if ( $option['type'] === 'select' and isset( $option['options'] ) ) {
$field->options = $option['options'];
}
}
$ui->append( 'submit', 'save', _t( 'Save' ) );
$ui->on_success( array( $this, 'config_updated') );
$ui->out();
}