mirror of
https://github.com/processwire/processwire.git
synced 2025-08-18 04:22:10 +02:00
Additional wireCount updates per processwire/processwire-issues#408
This commit is contained in:
@@ -106,7 +106,7 @@ class FieldtypeOptions extends FieldtypeMulti implements Module {
|
||||
if(empty($value) || !count($value)) {
|
||||
$page->set($field->name, $field->initValue);
|
||||
}
|
||||
} else if($this->wire('process') != 'ProcessField' && !count($value)) {
|
||||
} else if($this->wire('process') != 'ProcessField' && !wireCount($value)) {
|
||||
$this->warning(
|
||||
$field->getLabel() . " ($field->name): " .
|
||||
$this->_('Configured pre-selection not populated since value is not always required. Please correct this field configuration.')
|
||||
@@ -469,7 +469,7 @@ class FieldtypeOptions extends FieldtypeMulti implements Module {
|
||||
/**
|
||||
* Get all options available for the given field
|
||||
*
|
||||
* @param id|string|Field $field Field name, id or object
|
||||
* @param int|string|Field $field Field name, id or object
|
||||
* @return SelectableOptionArray
|
||||
* @throws WireException
|
||||
*
|
||||
@@ -481,7 +481,7 @@ class FieldtypeOptions extends FieldtypeMulti implements Module {
|
||||
/**
|
||||
* Update, add, delete as needed to match the given $options
|
||||
*
|
||||
* @param id|string|Field $field Field name, id or object
|
||||
* @param int|string|Field $field Field name, id or object
|
||||
* @param SelectableOptionArray $options Options to save
|
||||
* @return array Summary of what occurred
|
||||
* @throws WireException
|
||||
|
@@ -48,6 +48,7 @@ class FieldtypeURL extends FieldtypeText {
|
||||
|
||||
|
||||
public function getInputfield(Page $page, Field $field) {
|
||||
/** @var InputfieldURL $inputfield */
|
||||
$inputfield = $this->modules->get('InputfieldURL');
|
||||
$inputfield->set('noRelative', $field->noRelative);
|
||||
$inputfield->set('addRoot', $field->addRoot);
|
||||
@@ -68,12 +69,16 @@ class FieldtypeURL extends FieldtypeText {
|
||||
$labelYes = $this->_('Yes');
|
||||
$labelNo = $this->_('No');
|
||||
|
||||
/** @var InputfieldAsmSelect $f */
|
||||
$f = $inputfields->getChildByName('textformatters');
|
||||
$f->notes = $this->_('The "HTML Entity Encoder" text formatter is recommended for URL fields.');
|
||||
if(!count($field->textformatters) || !in_array('TextformatterEntities', $field->textformatters)) {
|
||||
$textformatters = $field->get('textformatters');
|
||||
if(!is_array($textformatters)) $textformatters = array();
|
||||
if(!count($textformatters) || !in_array('TextformatterEntities', $textformatters)) {
|
||||
$this->warning($this->_('If this URL will be used for any output, it is strongly recommended that you select the "HTML Entity Encoder" for "Text Formatters" on the Details tab.')); // Wwarning to use the HTML entity encoder
|
||||
}
|
||||
|
||||
/** @var InputfieldRadios $f */
|
||||
$f = $this->modules->get('InputfieldRadios');
|
||||
$f->attr('name', 'noRelative');
|
||||
$f->label = $this->_('Allow relative/local URLs without "http://" at the beginning?');
|
||||
|
Reference in New Issue
Block a user