本文整理汇总了PHP中Widget::wrapFormElementWithError方法的典型用法代码示例。如果您正苦于以下问题:PHP Widget::wrapFormElementWithError方法的具体用法?PHP Widget::wrapFormElementWithError怎么用?PHP Widget::wrapFormElementWithError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widget
的用法示例。
在下文中一共展示了Widget::wrapFormElementWithError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$page = Administration::instance()->Page;
$page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/bbcww_api_client/assets/view.js'));
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$right = $layout->createColumn(Layout::LARGE);
$fieldset = Widget::Fieldset(__('Essentials'));
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[name]', General::sanitize($this->about()->name)));
if (isset($errors->{'about::name'})) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $errors->{'about::name'}));
} else {
$fieldset->appendChild($label);
}
$field_groups = $options = array();
foreach ($this->driver->getMemberSections() as $section) {
$source = $section->{'api-source'};
$field_groups[$section->handle] = array('fields' => $section->fields, 'section' => $section);
if (!isset($options[$source])) {
$options[$source] = array('label' => ucwords(strtr($source, '-', ' ')), 'options' => array());
}
$options[$source]['options'][] = array($section->handle, $this->parameters()->section == $section->handle, $section->name);
}
$label = Widget::Label(__('Section'));
$label->appendChild(Widget::Select('fields[section]', $options, array('id' => 'context')));
$fieldset->appendChild($label);
$left->appendChild($fieldset);
$fieldset = Widget::Fieldset(__('Overrides & Defaults'), '{$param}');
foreach ($this->driver->getMemberSections() as $section) {
$this->appendDuplicator($fieldset, $section, $this->parameters()->section == $section->handle ? array('overrides' => $this->parameters()->overrides, 'defaults' => $this->parameters()->defaults) : NULL);
}
$right->appendChild($fieldset);
$layout->appendTo($wrapper);
}
示例2: displaySettingsPanel
public function displaySettingsPanel(&$wrapper, $errors = null)
{
$wrapper->appendChild(new XMLElement('h4', ucwords($this->name())));
$wrapper->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][type]', $this->handle(), 'hidden'));
if ($this->get('id')) {
$wrapper->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][id]', $this->get('id'), 'hidden'));
}
$div = new XMLElement('div');
$div->setAttribute('class', 'group');
$label = Widget::Label(__('Label (fixed)'));
$label->appendChild(Widget::Input('fields[' . $this->get('sortorder') . '][label]', 'Entry Versions', null, array('readonly' => 'readonly')));
if (isset($errors['label'])) {
$div->appendChild(Widget::wrapFormElementWithError($label, $errors['label']));
} else {
$div->appendChild($label);
}
$div->appendChild($this->buildLocationSelect($this->get('location'), 'fields[' . $this->get('sortorder') . '][location]'));
$wrapper->appendChild($div);
$order = $this->get('sortorder');
$label = Widget::Label();
$input = Widget::Input("fields[{$order}][hide_in_publish]", 'yes', 'checkbox');
if ($this->get('show_in_publish') == 'no') {
$input->setAttribute('checked', 'checked');
}
$label->setValue($input->generate() . ' Hide version history list on publish page');
$wrapper->appendChild($label);
$this->appendShowColumnCheckbox($wrapper);
}
示例3: displayPublishPanel
function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
{
$value = NULL;
if (isset($data['value'])) {
$value = is_array($data['value']) ? self::__tagArrayToString($data['value']) : $data['value'];
}
$label = Widget::Label($this->get('label'));
$label->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, strlen($value) != 0 ? $value : NULL));
if ($flagWithError != NULL) {
$wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
} else {
$wrapper->appendChild($label);
}
if ($this->get('pre_populate_source') != NULL) {
$existing_tags = $this->findAllTags();
if (is_array($existing_tags) && !empty($existing_tags)) {
$taglist = new XMLElement('ul');
$taglist->setAttribute('class', 'tags');
foreach ($existing_tags as $tag) {
$taglist->appendChild(new XMLElement('li', $tag));
}
$wrapper->appendChild($taglist);
}
}
}
示例4: displayPublishPanel
public function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
{
$value = isset($data['author_id']) ? $data['author_id'] : NULL;
if (!is_array($value)) {
$value = array($value);
}
if (!$value) {
$value = $this->_engine->getAuthorID();
}
$authorManager = new AuthorManager($this->_engine);
$authors = $authorManager->fetch();
$options = array();
foreach ($authors as $a) {
$options[] = array($a->get('id'), in_array($a->get('id'), $value), $a->get('first_name') . ' ' . $a->get('last_name'));
}
$fieldname = 'fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix;
if ($this->get('allow_multiple_selection') == 'yes') {
$fieldname .= '[]';
}
$attr = array();
if ($this->get('allow_multiple_selection') == 'yes') {
$attr['multiple'] = 'multiple';
}
$label = Widget::Label($this->get('label'));
$label->appendChild(Widget::Select($fieldname, $options, $attr));
if ($flagWithError != NULL) {
$wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
} else {
$wrapper->appendChild($label);
}
}
示例5: displayPublishPanel
function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
{
$label = Widget::Label($this->get('label'));
if ($this->get('required') != 'yes') {
$label->appendChild(new XMLElement('i', __('Optional')));
}
$textarea = Widget::Textarea('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, $this->get('size'), '50', strlen($data['value']) != 0 ? General::sanitize($data['value']) : NULL);
if ($this->get('formatter') != 'none') {
$textarea->setAttribute('class', $this->get('formatter'));
}
/**
* Allows developers modify the textarea before it is rendered in the publish forms
*
* @delegate ModifyTextareaFieldPublishWidget
* @param string $context
* '/backend/'
* @param Field $field
* @param Widget $label
* @param Widget $textarea
*/
Symphony::ExtensionManager()->notifyMembers('ModifyTextareaFieldPublishWidget', '/backend/', array('field' => &$this, 'label' => &$label, 'textarea' => &$textarea));
$label->appendChild($textarea);
if ($flagWithError != NULL) {
$wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
} else {
$wrapper->appendChild($label);
}
}
示例6: displayPublishPanel
public function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
{
$value = isset($data['author_id']) ? $data['author_id'] : NULL;
$callback = Administration::instance()->getPageCallback();
if ($this->get('default_to_current_user') == 'yes' && empty($data) && empty($_POST)) {
$value = array(Administration::instance()->Author->get('id'));
}
if (!is_array($value)) {
$value = array($value);
}
$authors = AuthorManager::fetch();
$options = array();
foreach ($authors as $a) {
$options[] = array($a->get('id'), in_array($a->get('id'), $value), $a->get('first_name') . ' ' . $a->get('last_name'));
}
$fieldname = 'fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix;
if ($this->get('allow_multiple_selection') == 'yes') {
$fieldname .= '[]';
}
$attr = array();
if ($this->get('allow_multiple_selection') == 'yes') {
$attr['multiple'] = 'multiple';
}
$label = Widget::Label($this->get('label'));
$label->appendChild(Widget::Select($fieldname, $options, $attr));
if ($flagWithError != NULL) {
$wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
} else {
$wrapper->appendChild($label);
}
}
示例7: displayPublishPanel
function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
{
$note = isset($data['value']) ? $data['value'] : $this->get('note');
$editable = $this->get('editable');
# Add <div>
$div = new XMLElement("div", $note, array("id" => Lang::createHandle($this->get('label')), "class" => "publishnotes-note"));
$wrapper->appendChild($div);
# Editable
if (isset($editable) && $editable) {
$wrapper->setAttribute('class', $wrapper->getAttribute('class') . " editable");
$edit = new XMLElement("a", "Edit note", array("class" => "publishnotes-edit", "href" => "#edit"));
$wrapper->appendChild($edit);
# Add <textarea>
$label = Widget::Label("Edit: " . $this->get('label'), NULL, Lang::createHandle($this->get('label')));
$textarea = Widget::Textarea('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, 8, '50', strlen($note) != 0 ? General::sanitize($note) : NULL);
$label->appendChild($textarea);
$control = new XMLElement("div", '<input type="submit" value="Change note"/> or <a href="#">cancel</a>', array("class" => "control"));
$label->appendChild($control);
if ($flagWithError != NULL) {
$wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
} else {
$wrapper->appendChild($label);
}
}
}
示例8: displaySettingsPanel
public function displaySettingsPanel(&$wrapper, $errors = NULL)
{
parent::displaySettingsPanel($wrapper, $errors);
$sectionManager = new SectionManager($this->_engine);
$sections = $sectionManager->fetch(NULL, 'ASC', 'sortorder');
$options = array();
// iterate over sections to build list of fields
if (is_array($sections) && !empty($sections)) {
foreach ($sections as $section) {
$section_fields = $section->fetchFields();
if (!is_array($section_fields)) {
continue;
}
$fields = array();
foreach ($section_fields as $f) {
// only show select box link fields
if ($f->get('type') == 'selectbox_link') {
$fields[] = array($f->get('id'), $this->get('related_sbl_id') == $f->get('id'), $f->get('label'));
}
}
if (!empty($fields)) {
$options[] = array('label' => $section->get('name'), 'options' => $fields);
}
}
}
$group = new XMLElement('div', NULL, array('class' => 'group'));
$label = Widget::Label(__('Child Select Box Link'));
$label->appendChild(Widget::Select('fields[' . $this->get('sortorder') . '][related_sbl_id]', $options));
if (isset($errors['related_sbl_id'])) {
$group->appendChild(Widget::wrapFormElementWithError($label, $errors['related_sbl_id']));
} else {
$group->appendChild($label);
}
$wrapper->appendChild($group);
}
示例9: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$layout = new Layout();
$left = $layout->createColumn(Layout::SMALL);
$right = $layout->createColumn(Layout::LARGE);
// Essentials --------------------------------------------------------
$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(__('Content'));
$label = Widget::Label(__('Source XML'));
$input = Widget::Textarea('fields[xml]', $this->parameters()->{'xml'}, array('rows' => '24', 'cols' => '50', 'class' => 'code'));
$label->appendChild($input);
if (isset($errors->{'xml'})) {
$label = Widget::wrapFormElementWithError($label, $errors->{'xml'});
}
$fieldset->appendChild($label);
$right->appendChild($fieldset);
$layout->appendTo($wrapper);
}
示例10: displaySettingsPanel
public function displaySettingsPanel(&$wrapper, $errors = null)
{
$order = $this->get('sortorder');
$label = Widget::Label(__('Point <code>@links</code> to'));
$label->appendChild(Widget::Select("fields[{$order}][linked_field_id]", $this->findOptions()));
if (isset($errors['linked_field_id'])) {
$label = Widget::wrapFormElementWithError($label, $errors['linked_field_id']);
}
parent::displaySettingsPanel($wrapper, $errors, null, $label);
}
示例11: displayPublishPanel
public function displayPublishPanel(&$wrapper, $data = null, $error = null, $prefix = null, $postfix = null)
{
$label = Widget::Label($this->get('label'));
$name = $this->get('element_name');
$input = Widget::Input("fields{$prefix}[{$name}]{$postfix}", strlen($data['value']) != 0 ? General::sanitize($data['value']) : null);
$label->appendChild($input);
if ($error != null) {
$label = Widget::wrapFormElementWithError($label, $error);
}
$wrapper->appendChild($label);
}
示例12: view
public function view(SymphonyDOMElement $wrapper, MessageStack $errors)
{
$page = Administration::instance()->Page;
$page->insertNodeIntoHead($page->createScriptElement(URL . '/extensions/ds_sections/assets/view.js'));
$layout = new Layout();
$column_1 = $layout->createColumn(Layout::SMALL);
$column_2 = $layout->createColumn(Layout::SMALL);
$column_3 = $layout->createColumn(Layout::LARGE);
$fieldset = Widget::Fieldset(__('Essentials'));
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('fields[name]', General::sanitize($this->about()->name)));
if (isset($errors->{'about::name'})) {
$fieldset->appendChild(Widget::wrapFormElementWithError($label, $errors->{'about::name'}));
} else {
$fieldset->appendChild($label);
}
$label = Widget::Label(__('Section'));
$options = array();
foreach (new SectionIterator() as $section) {
$options[] = array($section->handle, $this->parameters()->section == $section->handle, $section->name);
}
$label->appendChild(Widget::Select('fields[section]', $options, array('id' => 'context')));
$fieldset->appendChild($label);
$column_1->appendChild($fieldset);
$fieldset = Widget::Fieldset(__('Processing Options'));
$label = Widget::Label(__('Filter Rules'));
$filters = $this->parameters()->filters;
if (!is_array($filters)) {
$filters = array();
}
$options = array(array('admin-only', in_array('admin-only', $filters), __('Admin Only')), array('send-email', in_array('send-email', $filters), __('Send Email')), array('expect-multiple', in_array('expect-multiple', $filters), __('Allow Multiple')));
###
# Delegate: AppendEventFilter
# Description: Allows adding of new filter rules to the Event filter
# rule select box. A reference to the $options array is provided, and selected filters
Extension::notify('AppendEventFilter', '/blueprints/events/', array('selected' => $filters, 'options' => &$options));
$label->appendChild(Widget::Select('fields[filters][]', $options, array('multiple' => 'multiple')));
$fieldset->appendChild($label);
$label = Widget::Label();
$input = Widget::Input('fields[output-id-on-save]', 'yes', 'checkbox');
if ($this->parameters()->{'output-id-on-save'} == true) {
$input->setAttribute('checked', 'checked');
}
$label->appendChild($input);
$label->appendChild(new DOMText(__('Add entry ID to the parameter pool in the format of $this-name-id when saving is successful.')));
$fieldset->appendChild($label);
$column_2->appendChild($fieldset);
$fieldset = Widget::Fieldset(__('Overrides & Defaults'), '{$param}');
foreach (new SectionIterator() as $section) {
$this->appendDuplicator($fieldset, $section, $this->parameters()->section == $section->handle ? array('overrides' => $this->parameters()->overrides, 'defaults' => $this->parameters()->defaults) : NULL);
}
$column_3->appendChild($fieldset);
$layout->appendTo($wrapper);
}
示例13: displayPublishPanel
public function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
{
$value = General::sanitize($data['value']);
$label = Widget::Label($this->get('label'));
$label->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, strlen($value) != 0 ? $value : NULL));
if ($flagWithError != NULL) {
$wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
} else {
$wrapper->appendChild($label);
}
}
示例14: displayPublishPanel
public function displayPublishPanel(&$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL)
{
if ($this->get('hide') != 'yes') {
$value = long2ip($data['value']);
$label = Widget::Label($this->get('label'));
$label->appendChild(Widget::Input('fields' . $fieldnamePrefix . '[' . $this->get('element_name') . ']' . $fieldnamePostfix, strlen($value) != 0 ? $value : NULL, 'text', array('disabled' => 'disabled')));
if ($flagWithError != NULL) {
$wrapper->appendChild(Widget::wrapFormElementWithError($label, $flagWithError));
} else {
$wrapper->appendChild($label);
}
}
}
示例15: displayPublishPanel
public function displayPublishPanel(SymphonyDOMElement $wrapper, MessageStack $errors, Entry $entry = NULL, $data = NULL)
{
$document = $wrapper->ownerDocument;
$sortorder = $this->{'sortorder'};
$element_name = $this->{'element-name'};
$label = Widget::Label(isset($this->{'publish-label'}) && strlen(trim($this->{'publish-label'})) > 0 ? $this->{'publish-label'} : $this->name);
// Input box:
$input = Widget::Input("fields[{$element_name}]", $data->value);
$label->appendChild($input);
if ($errors->valid()) {
$label = Widget::wrapFormElementWithError($label, $errors->current()->message);
}
$wrapper->appendChild($label);
}