本文整理汇总了PHP中Widget::Checkbox方法的典型用法代码示例。如果您正苦于以下问题:PHP Widget::Checkbox方法的具体用法?PHP Widget::Checkbox怎么用?PHP Widget::Checkbox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widget
的用法示例。
在下文中一共展示了Widget::Checkbox方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __form
//.........这里部分代码省略.........
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[name]', General::sanitize($fields['name'])));
if (isset($this->_errors['name'])) {
$group->appendChild(Widget::Error($label, $this->_errors['name']));
} else {
$group->appendChild($label);
}
$fieldset->appendChild($group);
$this->Form->appendChild($fieldset);
// Conditions
$fieldset = new XMLElement('fieldset');
$this->setContext($fieldset, array('sections', 'system', 'custom-xml'));
$fieldset->appendChild(new XMLElement('legend', __('Conditions')));
$p = new XMLElement('p', __('Leaving these fields empty will always execute the data source.'));
$p->setAttribute('class', 'help');
$fieldset->appendChild($p);
$group = new XMLElement('div');
$group->setAttribute('class', 'two columns');
$label = Widget::Label(__('Required Parameter'));
$label->setAttribute('class', 'column ds-param');
$label->appendChild(new XMLElement('i', __('Optional')));
$input = Widget::Input('fields[required_url_param]', trim($fields['required_url_param']), 'text', array('placeholder' => __('$param'), 'data-search-types' => 'parameters', 'data-trigger' => '$'));
$label->appendChild($input);
$group->appendChild($label);
$label = Widget::Label(__('Forbidden Parameter'));
$label->setAttribute('class', 'column ds-param');
$label->appendChild(new XMLElement('i', __('Optional')));
$input = Widget::Input('fields[negate_url_param]', trim($fields['negate_url_param']), 'text', array('placeholder' => __('$param'), 'data-search-types' => 'parameters', 'data-trigger' => '$'));
$label->appendChild($input);
$group->appendChild($label);
$fieldset->appendChild($group);
$group = new XMLElement('div');
$group->setAttribute('class', 'two columns ds-param');
$label = Widget::Checkbox('fields[redirect_on_required]', $fields['redirect_on_required'], __('Redirect to 404 page when the required parameter is not present'));
$label->setAttribute('class', 'column');
$group->appendChild($label);
$label = Widget::Checkbox('fields[redirect_on_forbidden]', $fields['redirect_on_forbidden'], __('Redirect to 404 page when the forbidden parameter is present'));
$label->setAttribute('class', 'column');
$group->appendChild($label);
$fieldset->appendChild($group);
$label = Widget::Checkbox('fields[redirect_on_empty]', $fields['redirect_on_empty'], __('Redirect to 404 page when no results are found'));
$label->setAttribute('class', 'column');
$fieldset->appendChild($label);
$this->Form->appendChild($fieldset);
// Filters
$fieldset = new XMLElement('fieldset');
$this->setContext($fieldset, array('sections', 'system'));
$fieldset->appendChild(new XMLElement('legend', __('Filters')));
$p = new XMLElement('p', __('Use %s syntax to filter by page parameters. A default value can be set using %s.', array('<code>{' . __('$param') . '}</code>', '<code>{' . __('$param:default') . '}</code>')));
$p->setAttribute('class', 'help');
$fieldset->appendChild($p);
foreach ($field_groups as $section_id => $section_data) {
$div = new XMLElement('div');
$div->setAttribute('class', 'contextual frame filters-duplicator');
$div->setAttribute('data-context', 'section-' . $section_id);
$div->setAttribute('data-interactive', 'data-interactive');
$ol = new XMLElement('ol');
$ol->setAttribute('class', 'suggestable');
$ol->setAttribute('data-interactive', 'data-interactive');
$ol->setAttribute('data-add', __('Add filter'));
$ol->setAttribute('data-remove', __('Remove filter'));
// Add system:id filter
if (isset($fields['filter'][$section_id]['system:id']) || isset($fields['filter'][$section_id]['id'])) {
$id = isset($fields['filter'][$section_id]['system:id']) ? $fields['filter'][$section_id]['system:id'] : $fields['filter'][$section_id]['id'];
$li = new XMLElement('li');
$li->setAttribute('class', 'unique');
示例2: createCheckboxSetting
/**
* Given the setting name and the label, this helper method will add
* the required markup for a checkbox to the given `$wrapper`.
*
* @since Symphony 2.5.2
* @param XMLElement $wrapper
* Passed by reference, this will have the resulting markup appended to it
* @param string $setting
* This will be used with $this->get() to get the existing value
* @param string $label_description
* This will be localisable and displayed after the checkbox when
* generated.
* @param string $help (optional)
* A help message to show below the checkbox.
* @return XMLElement
* The Label and Checkbox that was just added to the `$wrapper`.
*/
public function createCheckboxSetting(XMLElement &$wrapper, $setting, $label_description, $help = null)
{
$order = $this->get('sortorder');
$name = "fields[{$order}][{$setting}]";
$label = Widget::Checkbox($name, $this->get($setting), $label_description, $wrapper, $help);
$label->addClass('column');
return $label;
}
示例3: addSectionOptions
public function addSectionOptions(array &$meta = null)
{
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild(new XMLElement('legend', __('Options')));
$div = new XMLElement('div', null, array('class' => 'two columns'));
$hidediv = new XMLElement('div', null, array('class' => 'column'));
$label = Widget::Checkbox('meta[hidden]', $meta['hidden'], __('Hide this section from the back-end menu'));
$hidediv->appendChild($label);
$div->appendChild($hidediv);
$filterdiv = new XMLElement('div', null, array('class' => 'column'));
$label = Widget::Checkbox('meta[filter]', $meta['filter'], __('Allow filtering of section entries'));
$filterdiv->appendChild($label);
$div->appendChild($filterdiv);
$fieldset->appendChild($div);
$this->Form->appendChild($fieldset);
/**
* Allows extensions to add elements to the header of the Section Editor
* form. Usually for section settings, this delegate is passed the current
* `$meta` array and the `$this->_errors` array.
*
* @delegate AddSectionElements
* @since Symphony 2.2
* @param string $context
* '/blueprints/sections/'
* @param XMLElement $form
* An XMLElement of the current `$this->Form`, just after the Section
* settings have been appended, but before the Fields duplicator
* @param array $meta
* The current $_POST['meta'] array
* @param array $errors
* The current errors array
*/
Symphony::ExtensionManager()->notifyMembers('AddSectionElements', '/blueprints/sections/', array('form' => &$this->Form, 'meta' => &$meta, 'errors' => &$this->_errors));
}