本文整理汇总了PHP中Widget::Group方法的典型用法代码示例。如果您正苦于以下问题:PHP Widget::Group方法的具体用法?PHP Widget::Group怎么用?PHP Widget::Group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widget
的用法示例。
在下文中一共展示了Widget::Group方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
//.........这里部分代码省略.........
}
$label->prependChild($input);
$fieldset->appendChild($label);
$label = Widget::Label(__('HTML-encode text'));
$input = Widget::Input('fields[html-encode]', 'yes', 'checkbox');
if ($this->parameters()->{'html-encode'} == true) {
$input->setAttribute('checked', 'checked');
}
$label->prependChild($input);
$fieldset->appendChild($label);
*/
$right->appendChild($fieldset);
$layout->appendTo($wrapper);
// Build contexts ----------------------------------------------------
foreach ($field_groups as $section_handle => $section_data) {
$section = $section_data['section'];
$section_active = $this->parameters()->section == $section_handle;
$filter_data = $this->parameters()->filters;
$fields = array();
$duplicator = new Duplicator(__('Add Filter'));
$duplicator->addClass('filtering-duplicator context context-' . $section_handle);
// System ID template:
$item = $duplicator->createTemplate(__('System ID'));
$type_label = Widget::Label(__('Type'));
$type_label->setAttribute('class', 'small');
$type_label->appendChild(Widget::Select('type', array(array('is', false, 'Is'), array('is-not', false, 'Is not'))));
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input('value'));
$label->appendChild(Widget::Input('element-name', 'system:id', 'hidden'));
$item->appendChild(Widget::Group($type_label, $label));
// Field templates:
if (is_array($section_data['fields']) && !empty($section_data['fields'])) {
foreach ($section_data['fields'] as $field) {
if (!$field->canFilter()) {
continue;
}
$element_name = $field->{'element-name'};
$fields[$element_name] = $field;
$item = $duplicator->createTemplate($field->name, $field->name());
$field->displayDatasourceFilterPanel($item, null, null);
}
}
// Field isntances:
if (is_array($filter_data) && !empty($filter_data)) {
foreach ($filter_data as $filter) {
if (isset($fields[$filter['element-name']])) {
$element_name = $filter['element-name'];
$field = $fields[$element_name];
$item = $duplicator->createInstance($field->{'publish-label'}, $field->name());
$field->displayDatasourceFilterPanel($item, $filter, $errors->{$element_name});
} else {
if ($filter['element-name'] == 'system:id') {
$item = $duplicator->createInstance(__('System ID'));
$type_label = Widget::Label(__('Type'));
$type_label->appendChild(Widget::Select('type', array(array('is', false, 'Is'), array('is-not', $filter['type'] == 'is-not', 'Is not'))));
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input("value", $filter['value']));
$label->appendChild(Widget::Input('element-name', 'system:id', 'hidden'));
$item->appendChild(Widget::Group($type_label, $label));
}
}
}
示例2: displayDatasourceFilterPanel
public function displayDatasourceFilterPanel(SymphonyDOMElement $wrapper, $data = NULL, MessageStack $errors = NULL)
{
$data = $this->processFilter($data);
$document = $wrapper->ownerDocument;
$type_label = Widget::Label(__('Type'));
$type_label->setAttribute('class', 'small');
$type_label->appendChild(Widget::Select(sprintf('type', $this->{'element-name'}), $this->getFilterTypes($data)));
$wrapper->appendChild($type_label);
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input(sprintf('value', $this->{'element-name'}), $data->value));
$label->appendChild(Widget::Input('element-name', $this->{'element-name'}, 'hidden'));
$wrapper->appendChild(Widget::Group($type_label, $label));
}
示例3: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$page = $wrapper->ownerDocument;
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$right = $layout->createColumn(Layout::LARGE);
$fieldset = Widget::Fieldset(__('Essentials'));
// Name:
$label = Widget::Label(__('Name'));
$input = Widget::Input('fields[about][name]', General::sanitize($this->about()->name));
$label->appendChild($input);
if (isset($errors->{'about::name'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'about::name'});
}
$fieldset->appendChild($label);
$left->appendChild($fieldset);
$fieldset = Widget::Fieldset(__('Gravatar'), '<code>{$param}</code> or <code>Value</code>');
$label = Widget::Label(__('Email Addresses'));
$input = Widget::Input('fields[addresses]', $this->parameters()->{'addresses'});
$label->appendChild($input);
if (isset($errors->{'addresses'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'addresses'});
}
$help = $page->createElement('p');
$help->setAttribute('class', 'help');
$help->setValue(__('Enter email addresses separated by commas.'));
$fieldset->appendChild($label);
$fieldset->appendChild($help);
$label = Widget::Label(__('Default Image'));
$input = Widget::Input('fields[default]', $this->parameters()->{'default'});
$label->appendChild($input);
if (isset($errors->{'default'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'default'});
}
$help = $page->createElement('p');
$help->setAttribute('class', 'help');
$help->setValue(__('An image to use as a fallback, either identicon, monsterid, wavatar, 404 or a URL to your own image.'));
$fieldset->appendChild($label);
$fieldset->appendChild($help);
$size = $page->createElement('div');
$label = Widget::Label(__('Size'));
$input = Widget::Input('fields[size]', $this->parameters()->{'size'});
$label->appendChild($input);
if (isset($errors->{'size'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'size'});
}
$help = $page->createElement('p');
$help->setAttribute('class', 'help');
$help->setValue(__('Images sized from 1 to 512 pixels. Defaults to 80 pixels.'));
$size->appendChild($label);
$size->appendChild($help);
$rating = $page->createElement('div');
$label = Widget::Label(__('Rating'));
$input = Widget::Input('fields[rating]', $this->parameters()->{'rating'});
$label->appendChild($input);
if (isset($errors->{'rating'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'rating'});
}
$help = $page->createElement('p');
$help->setAttribute('class', 'help');
$help->setValue(__('Specify a content rating of g, pg, r, or x. Defaults to g.'));
$rating->appendChild($label);
$rating->appendChild($help);
$fieldset->appendChild(Widget::Group($size, $rating));
$right->appendChild($fieldset);
$layout->appendTo($wrapper);
}