diff --git a/wire/core/InputfieldWrapper.php b/wire/core/InputfieldWrapper.php
index 6fc6de1a..2fdb5f26 100644
--- a/wire/core/InputfieldWrapper.php
+++ b/wire/core/InputfieldWrapper.php
@@ -42,15 +42,15 @@ class InputfieldWrapper extends Inputfield implements \Countable, \IteratorAggre
*
*/
static protected $defaultMarkup = array(
- 'list' => "\n
element (if href is used).
+ * @property string $target Link target
*
*/
class InputfieldButton extends InputfieldSubmit {
diff --git a/wire/modules/Inputfield/InputfieldCKEditor/InputfieldCKEditor.module b/wire/modules/Inputfield/InputfieldCKEditor/InputfieldCKEditor.module
index aa7249ac..3d46433c 100644
--- a/wire/modules/Inputfield/InputfieldCKEditor/InputfieldCKEditor.module
+++ b/wire/modules/Inputfield/InputfieldCKEditor/InputfieldCKEditor.module
@@ -167,6 +167,9 @@ class InputfieldCKEditor extends InputfieldTextarea {
* Toolbar items split by commas
* Groups of toolbar items split by lines
* Toolbar lines that starts with '#' are ignored
+ *
+ * @param string $str
+ * @return array
*
*/
protected function toolbarStringToArray($str) {
@@ -299,7 +302,7 @@ class InputfieldCKEditor extends InputfieldTextarea {
if($this->contentsInlineCss) {
$this->config->styles->add($this->pathFromRoot($this->contentsInlineCss, true));
} else {
- $this->config->styles->add($this->config->urls->InputfieldCKEditor . "contents-inline.css");
+ $this->config->styles->add($this->config->urls('InputfieldCKEditor') . "contents-inline.css");
}
}
@@ -403,7 +406,7 @@ class InputfieldCKEditor extends InputfieldTextarea {
if($this->wire('files')->mkdir($path, true)) {
$this->message("Created new CKEditor external plugins directory: $url");
} else {
- $this->error("The CKEditor external plugins directory does not exist: $url - Please create it when/if you want to install external plugins.", Notice::warning);
+ $this->warning("The CKEditor external plugins directory does not exist: $url - Please create it when/if you want to install external plugins.");
}
}
continue;
@@ -463,6 +466,9 @@ class InputfieldCKEditor extends InputfieldTextarea {
* Clean up a value that will be sent to/from the editor
*
* This is primarily for HTML Purifier
+ *
+ * @param string $value
+ * @return string
*
*/
protected function purifyValue($value) {
@@ -517,6 +523,9 @@ class InputfieldCKEditor extends InputfieldTextarea {
* Process data submitted to a CKEditor field
*
* When inline mode is used, the content is run through HTML Purifier
+ *
+ * @param WireInputData $input
+ * @return $this
*
*/
public function ___processInput(WireInputData $input) {
@@ -637,9 +646,11 @@ class InputfieldCKEditor extends InputfieldTextarea {
if($f) $inputfields->remove($f);
}
+ /** @var InputfieldFieldset $wrapper */
$wrapper = $this->wire('modules')->get('InputfieldFieldset');
$wrapper->label = $this->_('CKEditor Settings');
+ /** @var InputfieldTextarea $f */
$f = $this->wire('modules')->get('InputfieldTextarea');
$f->attr('name', 'toolbar');
$f->attr('value', $this->toolbar);
@@ -650,6 +661,7 @@ class InputfieldCKEditor extends InputfieldTextarea {
$purifierInstalled = $this->wire('modules')->isInstalled('MarkupHTMLPurifier');
+ /** @var InputfieldRadios $f */
$f = $this->wire('modules')->get('InputfieldRadios');
$f->attr('name', 'inlineMode');
$f->label = $this->_('Editor Mode');
@@ -782,11 +794,13 @@ class InputfieldCKEditor extends InputfieldTextarea {
$this->_('only for this CKEditor field');
$wrapper->add($f);
+ /** @var InputfieldFieldset $fieldset */
$fieldset = $this->modules->get('InputfieldFieldset');
$fieldset->attr('name', '_plugins_fieldset');
$fieldset->label = $this->_('Plugins');
$wrapper->add($fieldset);
-
+
+ /** @var InputfieldCheckboxes $f */
$f = $this->modules->get('InputfieldCheckboxes');
$f->attr('name', 'extraPlugins');
$f->label = $this->_('Extra Plugins');
diff --git a/wire/modules/Inputfield/InputfieldCheckbox.module b/wire/modules/Inputfield/InputfieldCheckbox.module
index 51027a71..d3fd26f5 100644
--- a/wire/modules/Inputfield/InputfieldCheckbox.module
+++ b/wire/modules/Inputfield/InputfieldCheckbox.module
@@ -106,7 +106,7 @@ class InputfieldCheckbox extends Inputfield {
$this->checkedValueIsLabel = false;
}
// autocheck mode: when non-zero 'value' set, then 'checked=checked' is assumed
- if($this->autocheck || $this->formBuilder) $this->attr('checked', 'checked');
+ if($this->autocheck || $this->getSetting('formBuilder')) $this->attr('checked', 'checked');
}
diff --git a/wire/modules/Inputfield/InputfieldCheckboxes/InputfieldCheckboxes.module b/wire/modules/Inputfield/InputfieldCheckboxes/InputfieldCheckboxes.module
index 0dd36bbc..ebcb5a0f 100644
--- a/wire/modules/Inputfield/InputfieldCheckboxes/InputfieldCheckboxes.module
+++ b/wire/modules/Inputfield/InputfieldCheckboxes/InputfieldCheckboxes.module
@@ -40,6 +40,7 @@ class InputfieldCheckboxes extends InputfieldSelectMultiple implements Inputfiel
$entityEncode = $this->getSetting('entityEncodeText') === false ? false : true;
if($this->table) {
+ /** @var MarkupAdminDataTable $table */
$table = $this->modules->get("MarkupAdminDataTable");
$table->setEncodeEntities(false);
$table->addClass('pw-no-select');
@@ -62,7 +63,7 @@ class InputfieldCheckboxes extends InputfieldSelectMultiple implements Inputfiel
$ulClass = 'InputfieldCheckboxesStacked';
}
- if(!$table) $out = "\n";
+ if(!$table) $out = "";
foreach($this->getOptions() as $key => $value) {
$checked = '';
@@ -92,13 +93,13 @@ class InputfieldCheckboxes extends InputfieldSelectMultiple implements Inputfiel
$table->row($value);
} else {
//$value = str_replace(' ', ' ', $value);
- $out .= "\n\t$input$value ";
+ $out .= "$input$value ";
}
}
if($table) $out .= $table->render();
- else $out .= "\n ";
+ else $out .= " ";
return $out;
@@ -115,6 +116,7 @@ class InputfieldCheckboxes extends InputfieldSelectMultiple implements Inputfiel
public function ___getConfigInputfields() {
$inputfields = parent::___getConfigInputfields();
+ /** @var InputfieldInteger $f */
$f = $this->wire('modules')->get('InputfieldInteger');
$f->label = $this->_('Columns of Checkboxes');
$f->description = $this->_('If you want the checkboxes to display in columns (rather than stacked), enter the number of columns you want to use (up to 10). To display checkboxes side-by-side (inline) enter 1.');
diff --git a/wire/modules/Inputfield/InputfieldDatetime/InputfieldDatetime.module b/wire/modules/Inputfield/InputfieldDatetime/InputfieldDatetime.module
index 24a18a39..0201516d 100644
--- a/wire/modules/Inputfield/InputfieldDatetime/InputfieldDatetime.module
+++ b/wire/modules/Inputfield/InputfieldDatetime/InputfieldDatetime.module
@@ -173,7 +173,7 @@ class InputfieldDatetime extends Inputfield {
if(empty($value)) $value = '';
$yearRange = $sanitizer->entities($this->yearRange);
- $out = "\n" .
+ $out =
" getAttributesString($attrs) . " " .
"value='$value' " .
"data-dateformat='$dateFormatJS' " .
@@ -400,7 +400,7 @@ class InputfieldDatetime extends Inputfield {
$f->columnWidth = 50;
$inputfields->append($f);
- /** @var InputfieldText $f */
+ /** @var InputfieldText $field */
$field = $this->modules->get('InputfieldText');
$field->setAttribute('name', 'placeholder');
$field->label = $this->_('Placeholder Text');
diff --git a/wire/modules/Inputfield/InputfieldEmail.module b/wire/modules/Inputfield/InputfieldEmail.module
index 41ca92fa..5cc5f002 100644
--- a/wire/modules/Inputfield/InputfieldEmail.module
+++ b/wire/modules/Inputfield/InputfieldEmail.module
@@ -33,14 +33,14 @@ class InputfieldEmail extends InputfieldText {
if(!$this->label || $this->label == $this->name) $this->label = $this->_('E-Mail'); // label headline when no default specified
if($this->confirm && count($this->getErrors())) $this->attr('value', '');
$attrs = $this->getAttributes();
- $out = "\n getAttributesString($attrs) . " />";
+ $out = " getAttributesString($attrs) . " />";
if($this->confirm) {
foreach(array('id', 'name') as $key) {
if(isset($attrs[$key])) $attrs[$key] = '_' . $attrs[$key] . '_confirm';
}
$attrs['aria-label'] = $this->confirmLabel;
$attrs['placeholder'] = $this->confirmLabel;
- $out .= "\n getAttributesString($attrs) . " />
";
+ $out .= " getAttributesString($attrs) . " />
";
}
return $out;
}
@@ -75,6 +75,7 @@ class InputfieldEmail extends InputfieldText {
if($f) $inputfields->remove($f);
}
+ /** @var InputfieldCheckbox $f */
$f = $this->wire('modules')->get('InputfieldCheckbox');
$f->attr('name', 'confirm');
$f->label = $this->_('Confirm email address?');
diff --git a/wire/modules/Inputfield/InputfieldFieldset.module b/wire/modules/Inputfield/InputfieldFieldset.module
index 902bac58..24c5571a 100644
--- a/wire/modules/Inputfield/InputfieldFieldset.module
+++ b/wire/modules/Inputfield/InputfieldFieldset.module
@@ -14,7 +14,7 @@ class InputfieldFieldset extends InputfieldWrapper {
public function ___render() {
// Note the extra "\n" is required in order to prevent InputfieldWrapper from
// skipping over an empty fieldset. Empty fieldsets are used by InputfieldRepeater
- // for thier description/label, and possibly others use it the same way.
+ // for their description/label, and possibly others use it the same way.
return parent::___render() . "\n";
}
diff --git a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module
index 1c9ce939..dfd4f7a9 100644
--- a/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module
+++ b/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module
@@ -19,6 +19,15 @@
* @property bool|int $noCollapseItem Set to true to disable collapsed items (like for LanguageTranslator tool or other things that add tools to files)
* @property bool|int $noShortName Set to true to disable shortened filenames in output
* @property bool|int $noCustomButton Set to true to disable use of the styled
+ *
+ * @method string renderItem($pagefile, $id, $n)
+ * @method string renderList($value)
+ * @method string renderUpload($value)
+ * @method void fileAdded(Pagefile $pagefile)
+ * @method array extractMetadata(Pagefile $pagefile, array $metadata = array())
+ * @method void processInputAddFile($filename)
+ * @method void processInputDeleteFile(Pagefile $pagefile)
+ * @method bool processInputFile(WireInputData $input, Pagefile $pagefile, $n)
*
*/
class InputfieldFile extends Inputfield implements InputfieldItemList {
@@ -181,7 +190,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList {
* Set the parent of this Inputfield
*
* @param InputfieldWrapper $parent
- * @return this
+ * @return $this
*
*/
public function setParent(InputfieldWrapper $parent) {
@@ -195,7 +204,8 @@ class InputfieldFile extends Inputfield implements InputfieldItemList {
}
protected function renderItemDescriptionField(Pagefile $pagefile, $id, $n) {
-
+
+ if($n) {}
$out = '';
$tabs = '';
static $hasLangTabs = null;
@@ -317,26 +327,26 @@ class InputfieldFile extends Inputfield implements InputfieldItemList {
$deleteLabel = $this->labels['delete'];
$out =
- "\n\t\t" .
- "\n\t\t";
return $out;
}
@@ -347,7 +357,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList {
// they will get strict notices from php if we add a new argument here.
$item = $this->currentItem;
$id = $item && !$this->renderValueMode ? " id='file_$item->hash'" : "";
- return "\n\t$out\n\t ";
+ return "$out ";
}
protected function renderListReady($value) {
@@ -380,12 +390,13 @@ class InputfieldFile extends Inputfield implements InputfieldItemList {
$class = 'InputfieldFileList ui-helper-clearfix';
if($this->overwrite && !$this->renderValueMode) $class .= " InputfieldFileOverwrite";
- if($out) $out = "\n";
+ if($out) $out = "";
return $out;
}
protected function ___renderUpload($value) {
+ if($value) {}
if($this->noUpload || $this->renderValueMode) return '';
// enables user to choose more than one file
@@ -570,6 +581,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList {
}
$this->value->add($filename);
+ /** @var Pagefile $item */
$item = $this->value->last();
try {
@@ -610,6 +622,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList {
if($replace) {
if(strpos($replace, '?') !== false) {
list($replace, $unused) = explode('?', $replace);
+ if($unused) {}
}
$replaceFile = $this->value->getFile($replace);
if($replaceFile && $replaceFile instanceof Pagefile) {
@@ -766,9 +779,11 @@ class InputfieldFile extends Inputfield implements InputfieldItemList {
/**
* Send an ajax response
*
- * $error bool Whether it was successful
- * $message string Message you want to return
- * $file string Full path and filename or blank if not applicable
+ * @param bool $error Whether it was successful
+ * @param string $message Message you want to return
+ * @param string $file Full path and filename or blank if not applicable
+ * @param string $size
+ * @param string $markup
*
*/
protected function ajaxResponse($error, $message, $file = '', $size = '', $markup = '') {
@@ -825,7 +840,8 @@ class InputfieldFile extends Inputfield implements InputfieldItemList {
*/
public function ___getConfigInputfields() {
$inputfields = parent::___getConfigInputfields();
-
+
+ /** @var InputfieldCheckbox $f */
$f = $this->modules->get("InputfieldCheckbox");
$f->attr('name', 'unzip');
$f->attr('value', 1);
@@ -863,8 +879,6 @@ class InputfieldFile extends Inputfield implements InputfieldItemList {
$inputfields->append($f);
}
- // @todo make noAjax option configurable
-
return $inputfields;
}
diff --git a/wire/modules/Inputfield/InputfieldFloat.module b/wire/modules/Inputfield/InputfieldFloat.module
index 6f1f77f9..4723b8f6 100644
--- a/wire/modules/Inputfield/InputfieldFloat.module
+++ b/wire/modules/Inputfield/InputfieldFloat.module
@@ -1,5 +1,12 @@
" .
+ $out =
+ "";
+ "";
return $out;
}
@@ -167,7 +169,8 @@ class InputfieldForm extends InputfieldWrapper {
$delayedN = count($delayedChildren);
$processedN = 0;
$unprocessedN = 0;
-
+
+ /** @var Inputfield[] $savedChildren */
$savedChildren = $delayedChildren;
while(count($delayedChildren)) {
@@ -191,6 +194,7 @@ class InputfieldForm extends InputfieldWrapper {
// whether we should process $child now or not
$processNow = true;
+ $selector = null;
foreach($selectors as $selector) {
@@ -204,8 +208,8 @@ class InputfieldForm extends InputfieldWrapper {
// if field had already been through the loop, but was not processed, add it back in for processing
if(!isset($delayedChildren[$name])
- && !$savedChildren[$name]->showIfProcessed
- && !$savedChildren[$name]->showIfSkipped) {
+ && !$savedChildren[$name]->getSetting('showIfProcessed')
+ && !$savedChildren[$name]->getSetting('showIfSkipped')) {
$delayedChildren[$name] = $savedChildren[$name];
}
@@ -214,13 +218,13 @@ class InputfieldForm extends InputfieldWrapper {
$savedChildren[$name]->showIf = '1>0'; // forced match
}
- if($savedChildren[$name]->showIfSkipped) {
+ if($savedChildren[$name]->getSetting('showIfSkipped')) {
// dependency $field does not need to be processed, so neither does this field
unset($delayedChildren[$child->name]);
$processNow = false;
if(self::debug) $this->debugNote("Removing field '$child->name' because '$name' it not shown.");
- } else if(!$savedChildren[$name]->showIfProcessed) {
+ } else if(!$savedChildren[$name]->getSetting('showIfProcessed')) {
// dependency $field is another one in $delayedChildren, send it back to the end
unset($delayedChildren[$child->name]);
// put it back on the end
@@ -305,7 +309,7 @@ class InputfieldForm extends InputfieldWrapper {
* Process input for fields with a required-if dependency
*
* @param WireInputData $input
- * @param array $delayedChildren
+ * @param array|Inputfield[] $delayedChildren
* @return bool
*
*/
@@ -313,7 +317,7 @@ class InputfieldForm extends InputfieldWrapper {
// process input for any remaining delayedChildren not already processed by processInputShowIf
foreach($delayedChildren as $child) {
- if($child->showIfSkipped || $child->showIfProcessed) continue;
+ if($child->getSetting('showIfSkipped') || $child->getSetting('showIfProcessed')) continue;
if(self::debug) $this->debugNote("Now Processing requiredIf delayed child: $child->name");
$child->processInput($input);
}
@@ -326,7 +330,7 @@ class InputfieldForm extends InputfieldWrapper {
// if field was not shown, then it can't be required
- if($child->showIfSkipped) continue;
+ if($child->getSetting('showIfSkipped')) continue;
$required = true;
$selectorString = $child->getSetting('requiredIf');
@@ -374,7 +378,7 @@ class InputfieldForm extends InputfieldWrapper {
* Does the selector match the given Inputfield name?
*
* @param Selector $selector
- * @param $name Name of Inputfield
+ * @param string $name Name of Inputfield
* @param string $debugNote Optional qualifier note for debugging
* @return bool|null Returns true|false if match determined, or NULL if $name is not present in form
*
diff --git a/wire/modules/Inputfield/InputfieldHidden.module b/wire/modules/Inputfield/InputfieldHidden.module
index b9cd1743..0bc7b2f0 100644
--- a/wire/modules/Inputfield/InputfieldHidden.module
+++ b/wire/modules/Inputfield/InputfieldHidden.module
@@ -22,7 +22,7 @@ class InputfieldHidden extends Inputfield {
}
public function ___render() {
- return "\n getAttributesString() . " />";
+ return " getAttributesString() . " />";
}
public function getAttributes() {
@@ -41,6 +41,7 @@ class InputfieldHidden extends Inputfield {
$f = $inputfields->getChildByName('columnWidth');
$inputfields->remove($f);
+ /** @var InputfieldText $field */
$field = $this->modules->get('InputfieldText');
$field->setAttribute('name', 'initValue');
$field->label = $this->_('Value');
diff --git a/wire/modules/Inputfield/InputfieldIcon/InputfieldIcon.module b/wire/modules/Inputfield/InputfieldIcon/InputfieldIcon.module
index 4ef4fa14..ac92d95f 100644
--- a/wire/modules/Inputfield/InputfieldIcon/InputfieldIcon.module
+++ b/wire/modules/Inputfield/InputfieldIcon/InputfieldIcon.module
@@ -1,5 +1,11 @@
prefixValue) {
+ if($this->getSetting('prefixValue')) {
if(strpos($value, self::prefix) !== 0) {
// add prefix
$value = self::prefix . $value;
diff --git a/wire/modules/Inputfield/InputfieldMarkup.module b/wire/modules/Inputfield/InputfieldMarkup.module
index a908840a..e8f61846 100644
--- a/wire/modules/Inputfield/InputfieldMarkup.module
+++ b/wire/modules/Inputfield/InputfieldMarkup.module
@@ -65,12 +65,12 @@ class InputfieldMarkup extends InputfieldWrapper {
if($this->getSetting('entityEncodeText') !== false && $textFormat != Inputfield::textFormatNone) {
if($textFormat == Inputfield::textFormatBasic) {
$description = $this->entityEncode($description, Inputfield::textFormatBasic);
- $out = "\n{$description}
$out";
+ $out = "{$description}
$out";
} else if($textFormat == Inputfield::textFormatMarkdown) {
- $out = "\n" . $this->entityEncode($description, Inputfield::textFormatMarkdown) . "
$out";
+ $out = "" . $this->entityEncode($description, Inputfield::textFormatMarkdown) . "
$out";
}
} else {
- $out = "\n$description
$out";
+ $out = "$description
$out";
}
$this->description = ''; // prevents it from appearing again at the bottom
}
diff --git a/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module b/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module
index a4e3c51f..4667cb2d 100644
--- a/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module
+++ b/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module
@@ -575,7 +575,7 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
$inputfield->addClass($addClass);
}
- $out = "\n";
+ $out = "
";
$out .= $inputfield->render();
$out .= $this->renderAddable();
@@ -606,7 +606,7 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
"value='$selector' />";
}
- $out .= "\n
";
+ $out .= "
";
return $out;
}
@@ -657,14 +657,14 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
$label =" " . $this->_('Create New');
$out =
- "\n" .
- "\n\t
$label
" .
- "\n\t
" .
- "\n\t\t$description " .
- "\n\t\t$input" .
- "\n\t\t$notes " .
- "\n\t
" .
- "\n
";
+ "" .
+ "
$label
" .
+ "
" .
+ "$description " .
+ "$input" .
+ "$notes " .
+ "
" .
+ "
";
return $out;
}
diff --git a/wire/modules/Inputfield/InputfieldPageAutocomplete/InputfieldPageAutocomplete.module b/wire/modules/Inputfield/InputfieldPageAutocomplete/InputfieldPageAutocomplete.module
index 8f2fc4b2..672fa83f 100644
--- a/wire/modules/Inputfield/InputfieldPageAutocomplete/InputfieldPageAutocomplete.module
+++ b/wire/modules/Inputfield/InputfieldPageAutocomplete/InputfieldPageAutocomplete.module
@@ -105,7 +105,7 @@ class InputfieldPageAutocomplete extends Inputfield implements InputfieldHasArra
if(strpos($label, '&') !== false) $label = $this->wire('sanitizer')->unentities($label);
$label = $this->wire('sanitizer')->entities($label);
$out =
- "\n" .
+ " " .
" " .
"$value " .
"$label " .
@@ -122,7 +122,7 @@ class InputfieldPageAutocomplete extends Inputfield implements InputfieldHasArra
*/
protected function ___renderList() {
- $out = "\n" .
+ $out = "" .
$this->renderListItem("Label", "1", "itemTemplate");
foreach($this->value as $page_id) {
@@ -135,7 +135,7 @@ class InputfieldPageAutocomplete extends Inputfield implements InputfieldHasArra
$out .= $this->renderListItem($value, $page->id);
}
- $out .= "\n ";
+ $out .= " ";
return $out;
}
diff --git a/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelect.module b/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelect.module
index ecaf7367..41a5e473 100644
--- a/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelect.module
+++ b/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelect.module
@@ -64,7 +64,7 @@ class InputfieldPageListSelect extends Inputfield implements InputfieldPageListS
$attrs['data-cancel'] = $this->cancelLabel;
$attrs['data-labelName'] = $this->attr('name');
- $out = "\n getAttributesString($attrs) . " />";
+ $out = " getAttributesString($attrs) . " />";
return $out;
}
diff --git a/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelectMultiple.module b/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelectMultiple.module
index 87151bc6..a371cb4b 100644
--- a/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelectMultiple.module
+++ b/wire/modules/Inputfield/InputfieldPageListSelect/InputfieldPageListSelectMultiple.module
@@ -47,7 +47,7 @@ class InputfieldPageListSelectMultiple extends Inputfield implements InputfieldH
protected function renderListItem($label, $value, $class = '') {
if($class) $class = " $class";
$out =
- "\n " .
+ " " .
// " " .
" " .
"$value " .
@@ -73,7 +73,7 @@ class InputfieldPageListSelectMultiple extends Inputfield implements InputfieldH
return "" . $this->_('Unable to render this field due to missing parent page in field settings.') . '
';
}
- $out = "\n" . $this->renderListItem("Label", "1", "itemTemplate");
+ $out = "" . $this->renderListItem("Label", "1", "itemTemplate");
foreach($this->value as $page_id) {
$page = $this->pages->get((int) $page_id);
@@ -83,7 +83,7 @@ class InputfieldPageListSelectMultiple extends Inputfield implements InputfieldH
$out .= $this->renderListItem($label, $page->id);
}
- $out .= "\n ";
+ $out .= " ";
$this->addClass('InputfieldPageListSelectMultipleData');
$attrs = $this->getAttributes();
@@ -100,7 +100,7 @@ class InputfieldPageListSelectMultiple extends Inputfield implements InputfieldH
$attrStr = $this->getAttributesString($attrs);
$attrStr = "value='" . implode(',', $this->value) . "' $attrStr";
- $out .= "\n ";
+ $out .= " ";
return $out;
}
diff --git a/wire/modules/Inputfield/InputfieldPageName/InputfieldPageName.module b/wire/modules/Inputfield/InputfieldPageName/InputfieldPageName.module
index 95967e46..7d87e954 100644
--- a/wire/modules/Inputfield/InputfieldPageName/InputfieldPageName.module
+++ b/wire/modules/Inputfield/InputfieldPageName/InputfieldPageName.module
@@ -13,6 +13,7 @@
* @property string $checkboxName Leave blank to disable
* @property string $checkboxLabel
* @property string $checkboxValue
+ * @property string $checkboxSuffix
* @property bool $checkboxChecked
*
*/
@@ -286,7 +287,6 @@ class InputfieldPageName extends InputfieldName implements ConfigurableModule {
if(is_array($data[$name])) {
// data already in right save format, but need it to be a string for editing
- if(empty($replacements)) $replacements = self::$defaultReplacements;
$replacements = self::replacementArrayToString($data[$name]);
} else {
diff --git a/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTable.module b/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTable.module
index fbd60083..f88a8d60 100644
--- a/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTable.module
+++ b/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTable.module
@@ -378,6 +378,7 @@ class InputfieldPageTable extends Inputfield {
if(isset($fields[$column])) {
// custom
+ /** @var Field $field */
$field = $fields[$column];
$v = $item->getFormatted($fieldName);
if($field->type instanceof FieldtypeImage) {
diff --git a/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTableAjax.php b/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTableAjax.php
index 016c8310..5433ddfd 100644
--- a/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTableAjax.php
+++ b/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTableAjax.php
@@ -9,6 +9,8 @@
*
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
* https://processwire.com
+ *
+ * @method void checkAjax()
*
*/
@@ -123,7 +125,7 @@ class InputfieldPageTableAjax extends Wire {
protected function sortItems(Page $page, Field $field, $sort) {
// if this field has it's own sort settings, then we have nothing to do here.
- if($field->sortfields && $field->sortfields != 'sort') return;
+ if($field->get('sortfields') && $field->get('sortfields') != 'sort') return;
$value = $page->getUnformatted($field->name);
if(!$value instanceof PageArray || !$value->count()) return;
diff --git a/wire/modules/Inputfield/InputfieldRadios/InputfieldRadios.module b/wire/modules/Inputfield/InputfieldRadios/InputfieldRadios.module
index b2079057..1f9cc439 100644
--- a/wire/modules/Inputfield/InputfieldRadios/InputfieldRadios.module
+++ b/wire/modules/Inputfield/InputfieldRadios/InputfieldRadios.module
@@ -44,10 +44,10 @@ class InputfieldRadios extends InputfieldSelect {
// don't bother setting a width, we will let them float where they want instead
$ulClass = 'InputfieldRadiosFloated';
}
- $out = "\n\t";
+ $out = "";
} else {
- $out = "\n\t";
return $out;
}
@@ -95,6 +95,7 @@ class InputfieldRadios extends InputfieldSelect {
public function ___getConfigInputfields() {
$inputfields = parent::___getConfigInputfields();
+ /** @var InputfieldInteger $f */
$f = $this->wire('modules')->get('InputfieldInteger');
$f->label = $this->_('Columns of Radio Buttons');
$f->description = $this->_('If you want the radio buttons to display in columns (rather than stacked), enter the number of columns you want to use (up to 10). To display buttons side-by-side (inline) enter 1.');
diff --git a/wire/modules/Inputfield/InputfieldSelect.module b/wire/modules/Inputfield/InputfieldSelect.module
index 26c10061..5cf44d1f 100644
--- a/wire/modules/Inputfield/InputfieldSelect.module
+++ b/wire/modules/Inputfield/InputfieldSelect.module
@@ -8,7 +8,7 @@
* Sublcasses will want to override the render method, but it's not necessary to override processInput().
* Subclasses that select multiple values should implement the InputfieldHasArrayValue interface.
*
- * @todo add support for 'required' attribute?
+ * @property string|int $defaultValue
*
*/
class InputfieldSelect extends Inputfield {
@@ -51,7 +51,8 @@ class InputfieldSelect extends Inputfield {
*
* @param string $value Value that the option submits
* @param string $label|array Optional label associated with the value (if null, value will be used as the label)
- * @param array $attributes Optional attributes to be associated with this option (i.e. a 'selected' attribute for an tag)
+ * @param array $attributes Optional attributes to be associated with this option (i.e. a 'selected' attribute for
+ * an tag)
* @return $this
*
*/
@@ -65,8 +66,9 @@ class InputfieldSelect extends Inputfield {
/**
* Add multiple options at once
*
- * @param array $options May be associative or regular array. If associative, use $value => $label. If regular, use just array($value, ...)
- * @return this
+ * @param array $options May be associative or regular array. If associative, use $value => $label. If regular,
+ * use just array($value, ...)
+ * @return $this
*
*/
public function addOptions(array $options) {
@@ -83,7 +85,7 @@ class InputfieldSelect extends Inputfield {
* Lines with an equals sign are split into separate value and label, i.e. value=label
*
* @param string $value
- * @return this
+ * @return $this
*
*/
public function addOptionsString($value) {
@@ -141,6 +143,9 @@ class InputfieldSelect extends Inputfield {
/**
* Remove the option with the given value
+ *
+ * @param string|int $value
+ * @return $this
*
*/
public function removeOption($value) {
@@ -191,6 +196,9 @@ class InputfieldSelect extends Inputfield {
/**
* Returns whether the provided value is selected
+ *
+ * @param string|int $value
+ * @return bool
*
*/
public function isOptionSelected($value) {
@@ -208,14 +216,21 @@ class InputfieldSelect extends Inputfield {
}
if($this instanceof InputfieldHasArrayValue) {
- // if(is_array($this->attr('value'))) {
// multiple selection
+ /** @var InputfieldSelect $this */
return in_array($value, $this->attr('value'));
}
return "$value" == (string) $this->value;
}
-
+
+ /**
+ * Is the given option value disabled?
+ *
+ * @param $value
+ * @return bool
+ *
+ */
public function isOptionDisabled($value) {
$disabled = false;
if(isset($this->optionAttributes[$value])) {
@@ -225,26 +240,40 @@ class InputfieldSelect extends Inputfield {
return $disabled;
}
+ /**
+ * Render the given options
+ *
+ * @param array $options
+ * @param bool $allowBlank
+ * @return string
+ *
+ */
protected function renderOptions($options, $allowBlank = true) {
$out = '';
reset($options);
$key = key($options);
$hasBlankOption = empty($key);
- if($allowBlank && !$this->required && !$this->attr('multiple') && !$hasBlankOption) $out .= " ";
+ if($allowBlank && !$this->required && !$this->attr('multiple') && !$hasBlankOption) {
+ $out .= " ";
+ }
foreach($options as $value => $label) {
if(is_array($label)) {
- $out .= "\n\t" .
+ $out .=
+ "" .
$this->renderOptions($label, false) .
- "\n\t ";
+ " ";
continue;
}
$selected = $this->isOptionSelected($value) ? " selected='selected'" : '';
$attrs = $this->getOptionAttributesString($value);
- $out .= "\n\t" . $this->entityEncode($label) . " ";
+ $out .=
+ "" .
+ $this->entityEncode($label) .
+ " ";
}
return $out;
@@ -262,6 +291,7 @@ class InputfieldSelect extends Inputfield {
// when a value is required and the value is empty and a default value is specified, we use it.
if($this instanceof InputfieldHasArrayValue) {
+ /** @var InputfieldSelect $this */
$value = explode("\n", $this->defaultValue);
foreach($value as $k => $v) {
$value[$k] = trim($v); // remove possible extra LF
@@ -277,6 +307,8 @@ class InputfieldSelect extends Inputfield {
/**
* Render and return the output for this Select
+ *
+ * @return string
*
*/
public function ___render() {
@@ -285,13 +317,19 @@ class InputfieldSelect extends Inputfield {
unset($attrs['value']);
$out =
- "\ngetAttributesString($attrs) . ">" .
+ "getAttributesString($attrs) . ">" .
$this->renderOptions($this->options) .
- "\n ";
+ " ";
return $out;
}
+ /**
+ * Render non-editable value
+ *
+ * @return string
+ *
+ */
public function ___renderValue() {
$out = '';
@@ -315,7 +353,7 @@ class InputfieldSelect extends Inputfield {
}
}
- if(strlen($out)) $out = "";
+ if(strlen($out)) $out = "";
return $out;
}
@@ -335,8 +373,8 @@ class InputfieldSelect extends Inputfield {
/**
* Get an attributes string intended for the element
*
- * @param string|array $key If an array, it will be assumed to the attributes you want rendered. If a key for an existing option, then
- * the attributes for that option will be rendered.
+ * @param string|array $key If an array, it will be assumed to the attributes you want rendered. If a key for an
+ * existing option, then the attributes for that option will be rendered.
* @return string
*
*/
@@ -376,6 +414,7 @@ class InputfieldSelect extends Inputfield {
$value = $this->attr('value');
if($this instanceof InputfieldHasArrayValue) {
+ /** @var InputfieldSelect $this */
foreach($value as $k => $v) {
if(!$this->isOption($v)) {
// $this->message("Removing invalid option: " . wire('sanitizer')->entities($value[$k]), Notice::debug);
@@ -393,12 +432,27 @@ class InputfieldSelect extends Inputfield {
return $this;
}
+ /**
+ * Get property
+ *
+ * @param string $key
+ * @return array|mixed|null
+ *
+ */
public function get($key) {
if($key == 'options') return $this->options;
if($key == 'optionAttributes') return $this->optionAttributes;
return parent::get($key);
}
+ /**
+ * Set property
+ *
+ * @param string $key
+ * @param mixed $value
+ * @return $this
+ *
+ */
public function set($key, $value) {
if($key == 'options') {
@@ -407,10 +461,17 @@ class InputfieldSelect extends Inputfield {
return $this;
}
-
return parent::set($key, $value);
}
+ /**
+ * Set attribute
+ *
+ * @param array|string $key
+ * @param array|int|string $value
+ * @return $this
+ *
+ */
public function setAttribute($key, $value) {
if($key == 'value') {
if(is_object($value) || (is_string($value) && strpos($value, '|'))) {
@@ -429,6 +490,12 @@ class InputfieldSelect extends Inputfield {
return parent::setAttribute($key, $value);
}
+ /**
+ * Is the value empty?
+ *
+ * @return bool
+ *
+ */
public function isEmpty() {
$value = $this->attr('value');
@@ -447,9 +514,16 @@ class InputfieldSelect extends Inputfield {
} else {
return strlen($value) === 0;
}
+
+ return false;
}
-
+ /**
+ * Field configuration
+ *
+ * @return InputfieldWrapper
+ *
+ */
public function ___getConfigInputfields() {
$inputfields = parent::___getConfigInputfields();
@@ -474,7 +548,6 @@ class InputfieldSelect extends Inputfield {
$f = $this->wire('modules')->get('InputfieldTextarea');
$f->attr('name', 'options');
$value = '';
- $options = array();
foreach($this->options as $key => $option) {
if(is_array($option)) {
$value .= "$key\n";
diff --git a/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module b/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module
index cbad95c3..31dd52da 100644
--- a/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module
+++ b/wire/modules/Inputfield/InputfieldSubmit/InputfieldSubmit.module
@@ -9,6 +9,7 @@
*
* @property bool $header Whether or not button will also appear in header.
* @property bool $secondary Whether or not button is secondary.
+ * @property string $dropdownInputName #pw-internal
*
*/
class InputfieldSubmit extends Inputfield {
@@ -143,7 +144,6 @@ class InputfieldSubmit extends Inputfield {
$config->scripts->add($config->urls->InputfieldSubmit . $file);
$numValues = 0;
$dropdownID = $this->attr('id') . '_dropdown';
- $out = '';
$out = "