mirror of
https://github.com/processwire/processwire.git
synced 2025-08-11 09:14:58 +02:00
Various minor code and documentation updates
This commit is contained in:
@@ -52,6 +52,7 @@
|
|||||||
* @method string setupPageName(Page $page, array $options = array()) Determine and populate a name for the given page. #pw-internal
|
* @method string setupPageName(Page $page, array $options = array()) Determine and populate a name for the given page. #pw-internal
|
||||||
* @method void insertBefore(Page $page, Page $beforePage) Insert one page as a sibling before another. #pw-advanced
|
* @method void insertBefore(Page $page, Page $beforePage) Insert one page as a sibling before another. #pw-advanced
|
||||||
* @method void insertAfter(Page $page, Page $afterPage) Insert one page as a sibling after another. #pw-advanced
|
* @method void insertAfter(Page $page, Page $afterPage) Insert one page as a sibling after another. #pw-advanced
|
||||||
|
* @method bool touch($pages, $options = null, $type = 'modified') Update page modification time to now (or the given modification time). #pw-group-manipulation
|
||||||
*
|
*
|
||||||
* METHODS PURELY FOR HOOKS
|
* METHODS PURELY FOR HOOKS
|
||||||
* ========================
|
* ========================
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
* For documentation about the fields used in this class, please see:
|
* For documentation about the fields used in this class, please see:
|
||||||
* /wire/core/Fieldtype.php
|
* /wire/core/Fieldtype.php
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@@ -22,11 +22,9 @@ class FieldtypePageTitle extends FieldtypeText implements FieldtypePageTitleComp
|
|||||||
'version' => 100,
|
'version' => 100,
|
||||||
'summary' => 'Field that stores a page title',
|
'summary' => 'Field that stores a page title',
|
||||||
'permanent' => true,
|
'permanent' => true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static $languageSupport = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This field is only used for new fields in advanced mode
|
* This field is only used for new fields in advanced mode
|
||||||
*
|
*
|
||||||
@@ -49,9 +47,16 @@ class FieldtypePageTitle extends FieldtypeText implements FieldtypePageTitleComp
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get compatible Fieldtypes
|
||||||
|
*
|
||||||
|
* @param Field $field
|
||||||
|
* @return Fieldtypes
|
||||||
|
*
|
||||||
|
*/
|
||||||
public function ___getCompatibleFieldtypes(Field $field) {
|
public function ___getCompatibleFieldtypes(Field $field) {
|
||||||
$fieldtypes = $this->wire(new Fieldtypes());
|
$fieldtypes = $this->wire(new Fieldtypes());
|
||||||
foreach($this->wire('fieldtypes') as $fieldtype) {
|
foreach($this->wire()->fieldtypes as $fieldtype) {
|
||||||
if($fieldtype instanceof FieldtypePageTitleCompatible) {
|
if($fieldtype instanceof FieldtypePageTitleCompatible) {
|
||||||
$fieldtypes->add($fieldtype);
|
$fieldtypes->add($fieldtype);
|
||||||
}
|
}
|
||||||
@@ -59,10 +64,30 @@ class FieldtypePageTitle extends FieldtypeText implements FieldtypePageTitleComp
|
|||||||
return $fieldtypes;
|
return $fieldtypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Inputfield
|
||||||
|
*
|
||||||
|
* @param Page $page
|
||||||
|
* @param Field $field
|
||||||
|
* @return Inputfield|InputfieldPageTitle
|
||||||
|
*
|
||||||
|
*/
|
||||||
public function getInputfield(Page $page, Field $field) {
|
public function getInputfield(Page $page, Field $field) {
|
||||||
|
/** @var InputfieldPageTitle $inputField */
|
||||||
$inputField = $this->modules->get('InputfieldPageTitle');
|
$inputField = $this->modules->get('InputfieldPageTitle');
|
||||||
return $inputField;
|
return $inputField;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* True when language support is active, false if not
|
||||||
|
*
|
||||||
|
* Set by LanguageSupport.module to true during LanguageSupport::init()
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
* @deprecated No longer in use
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static $languageSupport = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
* For documentation about the fields used in this class, please see:
|
* For documentation about the fields used in this class, please see:
|
||||||
* /wire/core/Fieldtype.php
|
* /wire/core/Fieldtype.php
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2021 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@@ -54,7 +54,7 @@ class FieldtypeText extends Fieldtype {
|
|||||||
*/
|
*/
|
||||||
public function ___getCompatibleFieldtypes(Field $field) {
|
public function ___getCompatibleFieldtypes(Field $field) {
|
||||||
$fieldtypes = $this->wire(new Fieldtypes());
|
$fieldtypes = $this->wire(new Fieldtypes());
|
||||||
foreach($this->wire('fieldtypes') as $fieldtype) {
|
foreach($this->wire()->fieldtypes as $fieldtype) {
|
||||||
if($fieldtype instanceof FieldtypeText) {
|
if($fieldtype instanceof FieldtypeText) {
|
||||||
$fieldtypes->add($fieldtype);
|
$fieldtypes->add($fieldtype);
|
||||||
} else {
|
} else {
|
||||||
@@ -117,7 +117,7 @@ class FieldtypeText extends Fieldtype {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function isEmptyValue(Field $field, $value) {
|
public function isEmptyValue(Field $field, $value) {
|
||||||
return !strlen($value);
|
return !strlen("$value");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -162,7 +162,7 @@ class FieldtypeText extends Fieldtype {
|
|||||||
*/
|
*/
|
||||||
public function getDatabaseSchema(Field $field) {
|
public function getDatabaseSchema(Field $field) {
|
||||||
$schema = parent::getDatabaseSchema($field);
|
$schema = parent::getDatabaseSchema($field);
|
||||||
$len = $this->wire('database')->getMaxIndexLength();
|
$len = $this->wire()->database->getMaxIndexLength();
|
||||||
$schema['data'] = 'text NOT NULL';
|
$schema['data'] = 'text NOT NULL';
|
||||||
$schema['keys']['data_exact'] = "KEY `data_exact` (`data`($len))";
|
$schema['keys']['data_exact'] = "KEY `data_exact` (`data`($len))";
|
||||||
$schema['keys']['data'] = 'FULLTEXT KEY `data` (`data`)';
|
$schema['keys']['data'] = 'FULLTEXT KEY `data` (`data`)';
|
||||||
@@ -193,7 +193,7 @@ class FieldtypeText extends Fieldtype {
|
|||||||
$inputfields->add($fieldset);
|
$inputfields->add($fieldset);
|
||||||
|
|
||||||
/** @var InputfieldAsmSelect $f */
|
/** @var InputfieldAsmSelect $f */
|
||||||
$f = $this->modules->get('InputfieldAsmSelect');
|
$f = $modules->get('InputfieldAsmSelect');
|
||||||
$f->attr('name', 'textformatters');
|
$f->attr('name', 'textformatters');
|
||||||
$f->label = $this->_('Text formatters');
|
$f->label = $this->_('Text formatters');
|
||||||
|
|
||||||
@@ -216,7 +216,7 @@ class FieldtypeText extends Fieldtype {
|
|||||||
if($field->type->className() === 'FieldtypeText') {
|
if($field->type->className() === 'FieldtypeText') {
|
||||||
/** @var InputfieldSelect $field */
|
/** @var InputfieldSelect $field */
|
||||||
$defaultLabel = $this->_('Default');
|
$defaultLabel = $this->_('Default');
|
||||||
$f = $this->modules->get('InputfieldRadios');
|
$f = $modules->get('InputfieldRadios');
|
||||||
$f->attr('name', 'inputfieldClass');
|
$f->attr('name', 'inputfieldClass');
|
||||||
$f->label = $this->_('Input module');
|
$f->label = $this->_('Input module');
|
||||||
$f->description = $this->_('Save after changing this as it may affect what settings are available on the “Input” tab.');
|
$f->description = $this->_('Save after changing this as it may affect what settings are available on the “Input” tab.');
|
||||||
@@ -232,7 +232,6 @@ class FieldtypeText extends Fieldtype {
|
|||||||
$fieldset->add($f);
|
$fieldset->add($f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $inputfields;
|
return $inputfields;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,7 +248,7 @@ class FieldtypeText extends Fieldtype {
|
|||||||
if(isset($data['textformatters']) && is_array($data['textformatters'])) {
|
if(isset($data['textformatters']) && is_array($data['textformatters'])) {
|
||||||
$errors = array();
|
$errors = array();
|
||||||
foreach($data['textformatters'] as $className) {
|
foreach($data['textformatters'] as $className) {
|
||||||
if(!$this->wire('modules')->isInstalled($className)) {
|
if(!$this->wire()->modules->isInstalled($className)) {
|
||||||
$errors[] = "Requires module '$className' to be installed";
|
$errors[] = "Requires module '$className' to be installed";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -269,7 +268,7 @@ class FieldtypeText extends Fieldtype {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function ___importValue(Page $page, Field $field, $value, array $options = array()) {
|
public function ___importValue(Page $page, Field $field, $value, array $options = array()) {
|
||||||
if(is_array($value) && isset($value['default']) && !$this->wire('languages')) {
|
if(is_array($value) && isset($value['default']) && !$this->wire()->languages) {
|
||||||
// multi-language value to non-multi-language site, use only default language
|
// multi-language value to non-multi-language site, use only default language
|
||||||
$value = $value['default'];
|
$value = $value['default'];
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
* For documentation about the fields used in this class, please see:
|
* For documentation about the fields used in this class, please see:
|
||||||
* /wire/core/Fieldtype.php
|
* /wire/core/Fieldtype.php
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2018 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
* Properties set to $field that is using this type, acceessed by $field->get('property'):
|
* Properties set to $field that is using this type, acceessed by $field->get('property'):
|
||||||
@@ -190,7 +190,7 @@ class FieldtypeTextarea extends FieldtypeText {
|
|||||||
*/
|
*/
|
||||||
protected function htmlReplacements(Page $page, Field $field, &$value, $sleep = true) {
|
protected function htmlReplacements(Page $page, Field $field, &$value, $sleep = true) {
|
||||||
|
|
||||||
$languages = $this->wire('languages');
|
$languages = $this->wire()->languages;
|
||||||
|
|
||||||
if(is_array($value)) {
|
if(is_array($value)) {
|
||||||
// array of values, most likely multi-language data123 columns from loadPageField
|
// array of values, most likely multi-language data123 columns from loadPageField
|
||||||
@@ -265,7 +265,7 @@ class FieldtypeTextarea extends FieldtypeText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static $lsep = null;
|
static $lsep = null;
|
||||||
if($lsep === null) $lsep = $this->wire('sanitizer')->unentities('
');
|
if($lsep === null) $lsep = $this->wire()->sanitizer->unentities('
');
|
||||||
if(strpos($value, $lsep) !== false) $value = str_replace($lsep, '', $value);
|
if(strpos($value, $lsep) !== false) $value = str_replace($lsep, '', $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,16 +279,17 @@ class FieldtypeTextarea extends FieldtypeText {
|
|||||||
*/
|
*/
|
||||||
public function getInputfield(Page $page, Field $field) {
|
public function getInputfield(Page $page, Field $field) {
|
||||||
|
|
||||||
|
$modules = $this->wire()->modules;
|
||||||
$inputfieldClass = $field->get('inputfieldClass');
|
$inputfieldClass = $field->get('inputfieldClass');
|
||||||
|
|
||||||
if($inputfieldClass) {
|
if($inputfieldClass) {
|
||||||
$inputfield = $this->modules->getModule($inputfieldClass, array('noSubstitute' => true));
|
$inputfield = $modules->getModule($inputfieldClass, array('noSubstitute' => true));
|
||||||
} else {
|
} else {
|
||||||
$inputfield = $this->modules->get(self::defaultInputfieldClass);
|
$inputfield = $modules->get(self::defaultInputfieldClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$inputfield) {
|
if(!$inputfield) {
|
||||||
$inputfield = $this->modules->get(self::defaultInputfieldClass);
|
$inputfield = $modules->get(self::defaultInputfieldClass);
|
||||||
$this->configHelper()->getInputfieldError($field);
|
$this->configHelper()->getInputfieldError($field);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +320,7 @@ class FieldtypeTextarea extends FieldtypeText {
|
|||||||
*/
|
*/
|
||||||
public function configHelper() {
|
public function configHelper() {
|
||||||
if(is_null($this->configHelper)) {
|
if(is_null($this->configHelper)) {
|
||||||
require_once($this->wire('config')->paths->FieldtypeTextarea . 'FieldtypeTextareaHelper.php');
|
require_once($this->wire()->config->paths('FieldtypeTextarea') . 'FieldtypeTextareaHelper.php');
|
||||||
$this->configHelper = new FieldtypeTextareaHelper();
|
$this->configHelper = new FieldtypeTextareaHelper();
|
||||||
}
|
}
|
||||||
return $this->configHelper;
|
return $this->configHelper;
|
||||||
@@ -400,7 +401,7 @@ class FieldtypeTextarea extends FieldtypeText {
|
|||||||
*/
|
*/
|
||||||
protected function importValueHTML($value, array $options) {
|
protected function importValueHTML($value, array $options) {
|
||||||
// update changed root URLs in href or src attributes
|
// update changed root URLs in href or src attributes
|
||||||
$config = $this->wire('config');
|
$config = $this->wire()->config;
|
||||||
$url = $config->urls->root;
|
$url = $config->urls->root;
|
||||||
$host = $config->httpHost;
|
$host = $config->httpHost;
|
||||||
$_url = isset($options['originalRootUrl']) ? $options['originalRootUrl'] : $url; // original URL
|
$_url = isset($options['originalRootUrl']) ? $options['originalRootUrl'] : $url; // original URL
|
||||||
@@ -453,7 +454,7 @@ class FieldtypeTextarea extends FieldtypeText {
|
|||||||
$searchFields = array();
|
$searchFields = array();
|
||||||
if($selector === true) $selector = "include=all";
|
if($selector === true) $selector = "include=all";
|
||||||
|
|
||||||
foreach($this->wire('fields') as $f) {
|
foreach($this->wire()->fields as $f) {
|
||||||
if($field) {
|
if($field) {
|
||||||
if("$f" != "$field") continue;
|
if("$f" != "$field") continue;
|
||||||
} else {
|
} else {
|
||||||
@@ -467,7 +468,7 @@ class FieldtypeTextarea extends FieldtypeText {
|
|||||||
$searchFields[$f->name] = $f->name;
|
$searchFields[$f->name] = $f->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!count($searchFields)) return $this->wire('pages')->newPageArray();
|
if(!count($searchFields)) return $this->wire()->pages->newPageArray();
|
||||||
|
|
||||||
return $this->markupQA()->findLinks($page, $searchFields, $selector, $options);
|
return $this->markupQA()->findLinks($page, $searchFields, $selector, $options);
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
/**
|
/**
|
||||||
* Helper class for FieldtypeTextarea configuration
|
* Helper class for FieldtypeTextarea configuration
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -27,9 +27,11 @@ class FieldtypeTextareaHelper extends Wire {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function getConfigInputfields(Field $field, InputfieldWrapper $inputfields) {
|
function getConfigInputfields(Field $field, InputfieldWrapper $inputfields) {
|
||||||
|
$modules = $this->wire()->modules;
|
||||||
|
|
||||||
$value = $field->get('inputfieldClass');
|
$value = $field->get('inputfieldClass');
|
||||||
/** @var InputfieldSelect $f */
|
/** @var InputfieldSelect $f */
|
||||||
$f = $this->modules->get('InputfieldSelect');
|
$f = $modules->get('InputfieldSelect');
|
||||||
$f->attr('name', 'inputfieldClass');
|
$f->attr('name', 'inputfieldClass');
|
||||||
$f->attr('value', $value ? $value : FieldtypeTextarea::defaultInputfieldClass);
|
$f->attr('value', $value ? $value : FieldtypeTextarea::defaultInputfieldClass);
|
||||||
$f->label = $this->_('Inputfield Type');
|
$f->label = $this->_('Inputfield Type');
|
||||||
@@ -48,7 +50,8 @@ class FieldtypeTextareaHelper extends Wire {
|
|||||||
$htmlLabel = $this->_('Markup/HTML');
|
$htmlLabel = $this->_('Markup/HTML');
|
||||||
$typeLabel = $this->_('Content Type');
|
$typeLabel = $this->_('Content Type');
|
||||||
|
|
||||||
$f = $this->modules->get('InputfieldRadios');
|
/** @var InputfieldRadios $f */
|
||||||
|
$f = $modules->get('InputfieldRadios');
|
||||||
$f->attr('name', 'contentType');
|
$f->attr('name', 'contentType');
|
||||||
$f->label = $typeLabel;
|
$f->label = $typeLabel;
|
||||||
$f->addOption(FieldtypeTextarea::contentTypeUnknown, $this->_('Unknown/Text'));
|
$f->addOption(FieldtypeTextarea::contentTypeUnknown, $this->_('Unknown/Text'));
|
||||||
@@ -62,13 +65,15 @@ class FieldtypeTextareaHelper extends Wire {
|
|||||||
$f->notes = sprintf($this->_('For more information about the options above see [description of content type options](%s).'), 'https://processwire.com/api/fieldtypes/textarea-fieldtype/#content-type');
|
$f->notes = sprintf($this->_('For more information about the options above see [description of content type options](%s).'), 'https://processwire.com/api/fieldtypes/textarea-fieldtype/#content-type');
|
||||||
$inputfields->append($f);
|
$inputfields->append($f);
|
||||||
|
|
||||||
$fieldset = $this->wire('modules')->get('InputfieldFieldset');
|
/** @var InputfieldFieldset $fieldset */
|
||||||
|
$fieldset = $modules->get('InputfieldFieldset');
|
||||||
$fieldset->label = "$htmlLabel ($typeLabel)";
|
$fieldset->label = "$htmlLabel ($typeLabel)";
|
||||||
$fieldset->icon = 'html5';
|
$fieldset->icon = 'html5';
|
||||||
$fieldset->showIf = 'contentType=' . FieldtypeTextarea::contentTypeHTML;
|
$fieldset->showIf = 'contentType=' . FieldtypeTextarea::contentTypeHTML;
|
||||||
$inputfields->add($fieldset);
|
$inputfields->add($fieldset);
|
||||||
|
|
||||||
$f = $this->modules->get('InputfieldCheckboxes');
|
/** @var InputfieldCheckboxes $f */
|
||||||
|
$f = $modules->get('InputfieldCheckboxes');
|
||||||
$f->attr('name', 'htmlOptions');
|
$f->attr('name', 'htmlOptions');
|
||||||
$f->label = $this->_('HTML Options');
|
$f->label = $this->_('HTML Options');
|
||||||
$f->description = $this->_('The following options provide additional quality assurance for HTML at runtime.');
|
$f->description = $this->_('The following options provide additional quality assurance for HTML at runtime.');
|
||||||
@@ -112,7 +117,7 @@ class FieldtypeTextareaHelper extends Wire {
|
|||||||
$fieldset->add($f);
|
$fieldset->add($f);
|
||||||
|
|
||||||
/** @var InputfieldCheckbox $f */
|
/** @var InputfieldCheckbox $f */
|
||||||
$f = $this->wire('modules')->get('InputfieldCheckbox');
|
$f = $modules->get('InputfieldCheckbox');
|
||||||
$f->attr('name', '_applyHTML');
|
$f->attr('name', '_applyHTML');
|
||||||
$f->label = $this->_('Apply HTML Options Now');
|
$f->label = $this->_('Apply HTML Options Now');
|
||||||
$f->description = $this->_('To apply the above options to all existing pages right now, check this box. This primarily focuses on the link abstraction option.');
|
$f->description = $this->_('To apply the above options to all existing pages right now, check this box. This primarily focuses on the link abstraction option.');
|
||||||
@@ -123,9 +128,9 @@ class FieldtypeTextareaHelper extends Wire {
|
|||||||
$f->showIf = 'htmlOptions=' . FieldtypeTextarea::htmlLinkAbstract;
|
$f->showIf = 'htmlOptions=' . FieldtypeTextarea::htmlLinkAbstract;
|
||||||
$fieldset->add($f);
|
$fieldset->add($f);
|
||||||
|
|
||||||
if($this->wire('input')->post('_applyHTML') && $this->wire('process') == 'ProcessField') {
|
if($this->wire()->input->post('_applyHTML') && $this->wire('process') == 'ProcessField') {
|
||||||
$this->applyFieldHTML = $field;
|
$this->applyFieldHTML = $field;
|
||||||
$this->wire('session')->addHookBefore('redirect', $this, 'applyFieldHTML');
|
$this->wire()->session->addHookBefore('redirect', $this, 'applyFieldHTML');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $inputfields;
|
return $inputfields;
|
||||||
@@ -139,6 +144,10 @@ class FieldtypeTextareaHelper extends Wire {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function applyFieldHTML(HookEvent $event) {
|
public function applyFieldHTML(HookEvent $event) {
|
||||||
|
if($event) {} // ignore
|
||||||
|
|
||||||
|
$pages = $this->wire()->pages;
|
||||||
|
$config = $this->wire()->config;
|
||||||
|
|
||||||
set_time_limit(3600);
|
set_time_limit(3600);
|
||||||
|
|
||||||
@@ -146,9 +155,9 @@ class FieldtypeTextareaHelper extends Wire {
|
|||||||
if(!$field || !$field instanceof Field || !$field->type instanceof FieldtypeTextarea) return;
|
if(!$field || !$field instanceof Field || !$field->type instanceof FieldtypeTextarea) return;
|
||||||
|
|
||||||
$selector = "$field->name%=href|src, include=all";
|
$selector = "$field->name%=href|src, include=all";
|
||||||
$total = $this->wire('pages')->count($selector);
|
$total = $pages->count($selector);
|
||||||
|
|
||||||
$applyMax = (int) $this->wire('config')->applyHTMLMaxItems;
|
$applyMax = (int) $config->applyHTMLMaxItems;
|
||||||
if(!$applyMax) $applyMax = 300;
|
if(!$applyMax) $applyMax = 300;
|
||||||
|
|
||||||
if($total > $applyMax) {
|
if($total > $applyMax) {
|
||||||
@@ -157,7 +166,7 @@ class FieldtypeTextareaHelper extends Wire {
|
|||||||
$selector .= ", limit=$applyMax, modified<=$modified";
|
$selector .= ", limit=$applyMax, modified<=$modified";
|
||||||
}
|
}
|
||||||
|
|
||||||
$items = $this->wire('pages')->find($selector);
|
$items = $pages->find($selector);
|
||||||
$totals = array();
|
$totals = array();
|
||||||
|
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
@@ -174,7 +183,7 @@ class FieldtypeTextareaHelper extends Wire {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->wire('pages')->touch($items, time());
|
$pages->touch($items, time());
|
||||||
|
|
||||||
if(!count($items) || count($items) == $total) {
|
if(!count($items) || count($items) == $total) {
|
||||||
$statusNote = ' ' .
|
$statusNote = ' ' .
|
||||||
@@ -187,10 +196,10 @@ class FieldtypeTextareaHelper extends Wire {
|
|||||||
$statusNote = sprintf($statusNote, '<code>$config->applyHTMLMaxItems = ' . ($applyMax * 2) . ';</code>');
|
$statusNote = sprintf($statusNote, '<code>$config->applyHTMLMaxItems = ' . ($applyMax * 2) . ';</code>');
|
||||||
}
|
}
|
||||||
|
|
||||||
$logFile = $this->wire('config')->paths->logs . 'markup-qa-errors.txt';
|
$logFile = $config->paths->logs . 'markup-qa-errors.txt';
|
||||||
$logInfo = '';
|
$logInfo = '';
|
||||||
if(is_file($logFile)) {
|
if(is_file($logFile)) {
|
||||||
$logURL = $this->wire('config')->urls->admin . 'setup/logs/view/markup-qa-errors/';
|
$logURL = $config->urls->admin . 'setup/logs/view/markup-qa-errors/';
|
||||||
$logInfo = ' ' . sprintf($this->_('(see %s log)'), "<a target='_blank' href='$logURL'>markup-qa-errors</a>");
|
$logInfo = ' ' . sprintf($this->_('(see %s log)'), "<a target='_blank' href='$logURL'>markup-qa-errors</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,7 +238,7 @@ class FieldtypeTextareaHelper extends Wire {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->wire('session')->message('<strong>' .
|
$this->wire()->session->message('<strong>' .
|
||||||
sprintf($this->_('Updated %1$d out of %2$d pages for HTML options.'), count($items), $total) . '</strong><br />' .
|
sprintf($this->_('Updated %1$d out of %2$d pages for HTML options.'), count($items), $total) . '</strong><br />' .
|
||||||
"$statusNote<br />" .
|
"$statusNote<br />" .
|
||||||
"<strong>$html5 " . $this->_('Markup/HTML quality assurance summary:') . '</strong><br />' .
|
"<strong>$html5 " . $this->_('Markup/HTML quality assurance summary:') . '</strong><br />' .
|
||||||
@@ -246,9 +255,10 @@ class FieldtypeTextareaHelper extends Wire {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function getInputfieldError(Field $field) {
|
public function getInputfieldError(Field $field) {
|
||||||
|
$config = $this->wire()->config;
|
||||||
|
|
||||||
$editURL = $this->wire('config')->urls->admin . "setup/field/edit?id=$field->id";
|
$editURL = $config->urls->admin . "setup/field/edit?id=$field->id";
|
||||||
$modulesURL = $this->wire('config')->urls->admin . "module/";
|
$modulesURL = $config->urls->admin . "module/";
|
||||||
$inputfieldClass = $field->get('inputfieldClass');
|
$inputfieldClass = $field->get('inputfieldClass');
|
||||||
$findURL = "https://processwire.com/search/?q=$inputfieldClass&t=Modules";
|
$findURL = "https://processwire.com/search/?q=$inputfieldClass&t=Modules";
|
||||||
$tab = '<br /> ';
|
$tab = '<br /> ';
|
||||||
@@ -260,7 +270,7 @@ class FieldtypeTextareaHelper extends Wire {
|
|||||||
"$tab 3. Select the \"Inputfield Type\". $tab 4. Click \"Save\".</small>";
|
"$tab 3. Select the \"Inputfield Type\". $tab 4. Click \"Save\".</small>";
|
||||||
|
|
||||||
if($inputfieldClass == 'InputfieldTinyMCE') {
|
if($inputfieldClass == 'InputfieldTinyMCE') {
|
||||||
$this->wire('modules')->getInstall('InputfieldCKEditor'); // install it so it's ready for them
|
$this->wire()->modules->getInstall('InputfieldCKEditor'); // install it so it's ready for them
|
||||||
$this->error(
|
$this->error(
|
||||||
"Field '$field->name' uses TinyMCE, which is no longer part of the core. " .
|
"Field '$field->name' uses TinyMCE, which is no longer part of the core. " .
|
||||||
"Please install <a target='_blank' href='$findURL'>TinyMCE</a> " .
|
"Please install <a target='_blank' href='$findURL'>TinyMCE</a> " .
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
* For documentation about the fields used in this class, please see:
|
* For documentation about the fields used in this class, please see:
|
||||||
* /wire/core/Fieldtype.php
|
* /wire/core/Fieldtype.php
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@@ -22,7 +22,7 @@ class FieldtypeURL extends FieldtypeText {
|
|||||||
'version' => 101,
|
'version' => 101,
|
||||||
'summary' => __('Field that stores a URL', __FILE__),
|
'summary' => __('Field that stores a URL', __FILE__),
|
||||||
'permanent' => true,
|
'permanent' => true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
@@ -39,22 +39,38 @@ class FieldtypeURL extends FieldtypeText {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function sanitizeValue(Page $page, Field $field, $value) {
|
public function sanitizeValue(Page $page, Field $field, $value) {
|
||||||
return $this->sanitizer->url($value, array(
|
return $this->wire()->sanitizer->url($value, array(
|
||||||
'allowRelative' => $field->get('noRelative') ? false : true,
|
'allowRelative' => $field->get('noRelative') ? false : true,
|
||||||
'allowIDN' => $field->get('allowIDN') ? true : false,
|
'allowIDN' => $field->get('allowIDN') ? true : false,
|
||||||
'stripQuotes' => $field->get('allowQuotes') ? false : true
|
'stripQuotes' => $field->get('allowQuotes') ? false : true
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Inputfield
|
||||||
|
*
|
||||||
|
* @param Page $page
|
||||||
|
* @param Field $field
|
||||||
|
* @return Inputfield|InputfieldURL
|
||||||
|
*
|
||||||
|
*/
|
||||||
public function getInputfield(Page $page, Field $field) {
|
public function getInputfield(Page $page, Field $field) {
|
||||||
/** @var InputfieldURL $inputfield */
|
/** @var InputfieldURL $inputfield */
|
||||||
$inputfield = $this->modules->get('InputfieldURL');
|
$inputfield = $this->wire()->modules->get('InputfieldURL');
|
||||||
$inputfield->set('noRelative', $field->get('noRelative'));
|
$inputfield->set('noRelative', $field->get('noRelative'));
|
||||||
$inputfield->set('addRoot', $field->get('addRoot'));
|
$inputfield->set('addRoot', $field->get('addRoot'));
|
||||||
return $inputfield;
|
return $inputfield;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format value
|
||||||
|
*
|
||||||
|
* @param Page $page
|
||||||
|
* @param Field $field
|
||||||
|
* @param string $value
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
*/
|
||||||
public function ___formatValue(Page $page, Field $field, $value) {
|
public function ___formatValue(Page $page, Field $field, $value) {
|
||||||
if($field->get('addRoot') && !$field->get('noRelative') && substr($value, 0, 1) == '/') {
|
if($field->get('addRoot') && !$field->get('noRelative') && substr($value, 0, 1) == '/') {
|
||||||
$root = rtrim($this->config->urls->root, '/');
|
$root = rtrim($this->config->urls->root, '/');
|
||||||
@@ -64,7 +80,16 @@ class FieldtypeURL extends FieldtypeText {
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get field configuration Inputfields
|
||||||
|
*
|
||||||
|
* @param Field $field
|
||||||
|
* @return InputfieldWrapper
|
||||||
|
*
|
||||||
|
*/
|
||||||
public function ___getConfigInputfields(Field $field) {
|
public function ___getConfigInputfields(Field $field) {
|
||||||
|
$modules = $this->wire()->modules;
|
||||||
|
|
||||||
$inputfields = parent::___getConfigInputfields($field);
|
$inputfields = parent::___getConfigInputfields($field);
|
||||||
$labelYes = $this->_('Yes');
|
$labelYes = $this->_('Yes');
|
||||||
$labelNo = $this->_('No');
|
$labelNo = $this->_('No');
|
||||||
@@ -79,7 +104,7 @@ class FieldtypeURL extends FieldtypeText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @var InputfieldRadios $f */
|
/** @var InputfieldRadios $f */
|
||||||
$f = $this->modules->get('InputfieldRadios');
|
$f = $modules->get('InputfieldRadios');
|
||||||
$f->attr('name', 'noRelative');
|
$f->attr('name', 'noRelative');
|
||||||
$f->label = $this->_('Allow relative/local URLs without "http://" at the beginning?');
|
$f->label = $this->_('Allow relative/local URLs without "http://" at the beginning?');
|
||||||
$f->addOption(0, $labelYes);
|
$f->addOption(0, $labelYes);
|
||||||
@@ -90,7 +115,8 @@ class FieldtypeURL extends FieldtypeText {
|
|||||||
$f->optionColumns = 1;
|
$f->optionColumns = 1;
|
||||||
$inputfields->add($f);
|
$inputfields->add($f);
|
||||||
|
|
||||||
$f = $this->modules->get('InputfieldRadios');
|
/** @var InputfieldRadios $f */
|
||||||
|
$f = $modules->get('InputfieldRadios');
|
||||||
$f->attr('name', 'allowIDN');
|
$f->attr('name', 'allowIDN');
|
||||||
$f->label = $this->_('Allow internationalized domain names (IDNs)?');
|
$f->label = $this->_('Allow internationalized domain names (IDNs)?');
|
||||||
$f->addOption(1, $labelYes);
|
$f->addOption(1, $labelYes);
|
||||||
@@ -101,7 +127,8 @@ class FieldtypeURL extends FieldtypeText {
|
|||||||
$f->optionColumns = 1;
|
$f->optionColumns = 1;
|
||||||
$inputfields->add($f);
|
$inputfields->add($f);
|
||||||
|
|
||||||
$f = $this->modules->get('InputfieldRadios');
|
/** @var InputfieldRadios $f */
|
||||||
|
$f = $modules->get('InputfieldRadios');
|
||||||
$f->attr('name', 'allowQuotes');
|
$f->attr('name', 'allowQuotes');
|
||||||
$f->label = $this->_('Allow single/double quote characters in URLs?');
|
$f->label = $this->_('Allow single/double quote characters in URLs?');
|
||||||
$f->addOption(1, $labelYes);
|
$f->addOption(1, $labelYes);
|
||||||
@@ -112,7 +139,8 @@ class FieldtypeURL extends FieldtypeText {
|
|||||||
$f->optionColumns = 1;
|
$f->optionColumns = 1;
|
||||||
$inputfields->add($f);
|
$inputfields->add($f);
|
||||||
|
|
||||||
$f = $this->modules->get('InputfieldRadios');
|
/** @var InputfieldRadios $f */
|
||||||
|
$f = $modules->get('InputfieldRadios');
|
||||||
$f->attr('name', 'addRoot');
|
$f->attr('name', 'addRoot');
|
||||||
$f->label = $this->_("Prepend site's root path to local/relative URLs?");
|
$f->label = $this->_("Prepend site's root path to local/relative URLs?");
|
||||||
$f->addOption(1, $labelYes);
|
$f->addOption(1, $labelYes);
|
||||||
|
@@ -49,7 +49,7 @@ class InputfieldSelect extends Inputfield implements InputfieldHasSelectableOpti
|
|||||||
'summary' => __('Selection of a single value from a select pulldown', __FILE__), // Module Summary
|
'summary' => __('Selection of a single value from a select pulldown', __FILE__), // Module Summary
|
||||||
'version' => 102,
|
'version' => 102,
|
||||||
'permanent' => true,
|
'permanent' => true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -3,6 +3,9 @@
|
|||||||
/**
|
/**
|
||||||
* An Inputfield for handling single line "text" form inputs
|
* An Inputfield for handling single line "text" form inputs
|
||||||
*
|
*
|
||||||
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
||||||
|
* https://processwire.com
|
||||||
|
*
|
||||||
* @property string $type Input type (typically "text")
|
* @property string $type Input type (typically "text")
|
||||||
* @property int $size Size of input or 0 for full width
|
* @property int $size Size of input or 0 for full width
|
||||||
* @property int $minlength Minimum allowed length of value (usually combined with 'required' option)
|
* @property int $minlength Minimum allowed length of value (usually combined with 'required' option)
|
||||||
@@ -32,7 +35,7 @@ class InputfieldText extends Inputfield {
|
|||||||
'summary' => __('Single line of text', __FILE__), // Module Summary
|
'summary' => __('Single line of text', __FILE__), // Module Summary
|
||||||
'version' => 106,
|
'version' => 106,
|
||||||
'permanent' => true,
|
'permanent' => true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,13 +57,18 @@ class InputfieldText extends Inputfield {
|
|||||||
$this->set('showCount', self::showCountNone);
|
$this->set('showCount', self::showCountNone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wired to API
|
||||||
|
*
|
||||||
|
*/
|
||||||
public function wired() {
|
public function wired() {
|
||||||
// if multi-language, support placeholders for each language
|
// if multi-language, support placeholders for each language
|
||||||
/** @var Languages $languages */
|
$languages = $this->wire()->languages;
|
||||||
$languages = $this->wire('languages');
|
if($languages) {
|
||||||
if($languages) foreach($languages as $language) {
|
foreach($languages as $language) {
|
||||||
// set to blank value so that Field::getInputfield() will recogize this setting is for InputfieldText
|
// set to blank value so that Field::getInputfield() will recogize this setting is for InputfieldText
|
||||||
if(!$language->isDefault()) $this->set("placeholder$language", '');
|
if(!$language->isDefault()) $this->set("placeholder$language", '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
parent::wired();
|
parent::wired();
|
||||||
}
|
}
|
||||||
@@ -149,8 +157,8 @@ class InputfieldText extends Inputfield {
|
|||||||
if(isset($attrs['maxlength']) && (int) $attrs['maxlength'] < 1) unset($attrs['maxlength']);
|
if(isset($attrs['maxlength']) && (int) $attrs['maxlength'] < 1) unset($attrs['maxlength']);
|
||||||
|
|
||||||
// placeholder attribute, languages support
|
// placeholder attribute, languages support
|
||||||
if(!empty($attrs['placeholder']) && $this->wire('languages')) {
|
if(!empty($attrs['placeholder']) && $this->wire()->languages) {
|
||||||
$language = $this->wire('user')->language;
|
$language = $this->wire()->user->language;
|
||||||
if($language && $language->id && !$language->isDefault()) {
|
if($language && $language->id && !$language->isDefault()) {
|
||||||
$placeholder = parent::get("placeholder$language->id");
|
$placeholder = parent::get("placeholder$language->id");
|
||||||
if(strlen($placeholder)) $attrs['placeholder'] = $placeholder;
|
if(strlen($placeholder)) $attrs['placeholder'] = $placeholder;
|
||||||
@@ -193,12 +201,12 @@ class InputfieldText extends Inputfield {
|
|||||||
protected function setAttributeValue($value) {
|
protected function setAttributeValue($value) {
|
||||||
|
|
||||||
if($this->maxlength > 0) {
|
if($this->maxlength > 0) {
|
||||||
$value = $this->wire('sanitizer')->text($value, array(
|
$value = $this->wire()->sanitizer->text($value, array(
|
||||||
'maxLength' => $this->maxlength,
|
'maxLength' => $this->maxlength,
|
||||||
'maxBytes' => $this->maxlength*4,
|
'maxBytes' => $this->maxlength*4,
|
||||||
'stripTags' => false,
|
'stripTags' => false,
|
||||||
'trim' => $this->noTrim ? false : true,
|
'trim' => $this->noTrim ? false : true,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->stripTags) $value = strip_tags($value);
|
if($this->stripTags) $value = strip_tags($value);
|
||||||
@@ -243,7 +251,9 @@ class InputfieldText extends Inputfield {
|
|||||||
|
|
||||||
if($this->pattern) {
|
if($this->pattern) {
|
||||||
$regex = '#' . str_replace('#', '\#', $this->pattern) . '#'; // add delimeters
|
$regex = '#' . str_replace('#', '\#', $this->pattern) . '#'; // add delimeters
|
||||||
if(!preg_match($regex, $value)) $this->error($this->_('Does not match required pattern'));
|
if(!preg_match($regex, $value)) {
|
||||||
|
$this->error($this->_('Does not match required pattern'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($minlength > 0 && $length < $minlength) {
|
if($minlength > 0 && $length < $minlength) {
|
||||||
@@ -276,10 +286,13 @@ class InputfieldText extends Inputfield {
|
|||||||
*/
|
*/
|
||||||
public function ___getConfigInputfields() {
|
public function ___getConfigInputfields() {
|
||||||
|
|
||||||
|
$modules = $this->wire()->modules;
|
||||||
|
$languages = $this->wire()->languages;
|
||||||
|
|
||||||
$inputfields = parent::___getConfigInputfields();
|
$inputfields = parent::___getConfigInputfields();
|
||||||
|
|
||||||
/** @var InputfieldInteger $field */
|
/** @var InputfieldInteger $field */
|
||||||
$field = $this->modules->get('InputfieldInteger');
|
$field = $modules->get('InputfieldInteger');
|
||||||
$field->setAttribute('name', 'minlength');
|
$field->setAttribute('name', 'minlength');
|
||||||
$field->label = $this->_('Minimum length');
|
$field->label = $this->_('Minimum length');
|
||||||
$field->setAttribute('value', (int) $this->minlength);
|
$field->setAttribute('value', (int) $this->minlength);
|
||||||
@@ -290,7 +303,7 @@ class InputfieldText extends Inputfield {
|
|||||||
$inputfields->append($field);
|
$inputfields->append($field);
|
||||||
|
|
||||||
/** @var InputfieldInteger $field */
|
/** @var InputfieldInteger $field */
|
||||||
$field = $this->modules->get('InputfieldInteger');
|
$field = $modules->get('InputfieldInteger');
|
||||||
$field->setAttribute('name', 'maxlength');
|
$field->setAttribute('name', 'maxlength');
|
||||||
$field->label = $this->_('Maximum length');
|
$field->label = $this->_('Maximum length');
|
||||||
$field->setAttribute('value', $this->attr('maxlength'));
|
$field->setAttribute('value', $this->attr('maxlength'));
|
||||||
@@ -301,7 +314,7 @@ class InputfieldText extends Inputfield {
|
|||||||
$inputfields->append($field);
|
$inputfields->append($field);
|
||||||
|
|
||||||
/** @var InputfieldRadios $field */
|
/** @var InputfieldRadios $field */
|
||||||
$field = $this->modules->get('InputfieldRadios');
|
$field = $modules->get('InputfieldRadios');
|
||||||
$field->attr('name', 'showCount');
|
$field->attr('name', 'showCount');
|
||||||
$field->label = $this->_('Counter');
|
$field->label = $this->_('Counter');
|
||||||
$field->addOption(0, $this->_('No counter'));
|
$field->addOption(0, $this->_('No counter'));
|
||||||
@@ -314,7 +327,7 @@ class InputfieldText extends Inputfield {
|
|||||||
$inputfields->add($field);
|
$inputfields->add($field);
|
||||||
|
|
||||||
/** @var InputfieldInteger $field */
|
/** @var InputfieldInteger $field */
|
||||||
$field = $this->modules->get('InputfieldInteger');
|
$field = $modules->get('InputfieldInteger');
|
||||||
$field->setAttribute('name', 'size');
|
$field->setAttribute('name', 'size');
|
||||||
$field->label = $this->_('Size');
|
$field->label = $this->_('Size');
|
||||||
$field->setAttribute('value', $this->attr('size') > 0 ? $this->attr('size') : 0);
|
$field->setAttribute('value', $this->attr('size') > 0 ? $this->attr('size') : 0);
|
||||||
@@ -324,7 +337,7 @@ class InputfieldText extends Inputfield {
|
|||||||
$inputfields->append($field);
|
$inputfields->append($field);
|
||||||
|
|
||||||
/** @var InputfieldCheckbox $field */
|
/** @var InputfieldCheckbox $field */
|
||||||
$field = $this->modules->get('InputfieldCheckbox');
|
$field = $modules->get('InputfieldCheckbox');
|
||||||
$field->attr('name', 'stripTags');
|
$field->attr('name', 'stripTags');
|
||||||
$field->label = $this->_('Strip Tags');
|
$field->label = $this->_('Strip Tags');
|
||||||
$field->description = $this->_('When checked, any HTML tags will be stripped from the input when the form is processed.');
|
$field->description = $this->_('When checked, any HTML tags will be stripped from the input when the form is processed.');
|
||||||
@@ -338,15 +351,15 @@ class InputfieldText extends Inputfield {
|
|||||||
$inputfields->append($field);
|
$inputfields->append($field);
|
||||||
|
|
||||||
/** @var InputfieldText $field */
|
/** @var InputfieldText $field */
|
||||||
$field = $this->modules->get('InputfieldText');
|
$field = $modules->get('InputfieldText');
|
||||||
$field->setAttribute('name', 'placeholder');
|
$field->setAttribute('name', 'placeholder');
|
||||||
$field->label = $this->_('Placeholder Text');
|
$field->label = $this->_('Placeholder Text');
|
||||||
$field->setAttribute('value', $this->attr('placeholder'));
|
$field->setAttribute('value', $this->attr('placeholder'));
|
||||||
$field->description = $this->_('Optional placeholder phrase of text that appears in the field when blank.');
|
$field->description = $this->_('Optional placeholder phrase of text that appears in the field when blank.');
|
||||||
$field->collapsed = Inputfield::collapsedBlank;
|
$field->collapsed = Inputfield::collapsedBlank;
|
||||||
if($this->wire('languages')) {
|
if($languages) {
|
||||||
$field->useLanguages = true;
|
$field->useLanguages = true;
|
||||||
foreach($this->wire('languages') as $language) {
|
foreach($languages as $language) {
|
||||||
if($language->isDefault()) continue;
|
if($language->isDefault()) continue;
|
||||||
$value = $this->getSetting("placeholder$language");
|
$value = $this->getSetting("placeholder$language");
|
||||||
if(!is_null($value)) $field->set("value$language", $value);
|
if(!is_null($value)) $field->set("value$language", $value);
|
||||||
@@ -355,7 +368,7 @@ class InputfieldText extends Inputfield {
|
|||||||
$inputfields->append($field);
|
$inputfields->append($field);
|
||||||
|
|
||||||
/** @var InputfieldText $field */
|
/** @var InputfieldText $field */
|
||||||
$field = $this->modules->get('InputfieldText');
|
$field = $modules->get('InputfieldText');
|
||||||
$field->setAttribute('name', 'pattern');
|
$field->setAttribute('name', 'pattern');
|
||||||
$field->label = $this->_('Pattern');
|
$field->label = $this->_('Pattern');
|
||||||
$field->setAttribute('value', $this->attr('pattern'));
|
$field->setAttribute('value', $this->attr('pattern'));
|
||||||
@@ -366,7 +379,7 @@ class InputfieldText extends Inputfield {
|
|||||||
|
|
||||||
if($this->hasFieldtype === false) {
|
if($this->hasFieldtype === false) {
|
||||||
/** @var InputfieldText $field */
|
/** @var InputfieldText $field */
|
||||||
$field = $this->modules->get('InputfieldText');
|
$field = $modules->get('InputfieldText');
|
||||||
$field->setAttribute('name', 'initValue');
|
$field->setAttribute('name', 'initValue');
|
||||||
$field->label = $this->_('Initial Value');
|
$field->label = $this->_('Initial Value');
|
||||||
$field->description = $this->_('Optional initial/default value pre-populated for the user.');
|
$field->description = $this->_('Optional initial/default value pre-populated for the user.');
|
||||||
@@ -389,8 +402,4 @@ class InputfieldText extends Inputfield {
|
|||||||
$a = array('initValue', 'pattern', 'placeholder', 'maxlength', 'minlength', 'required', 'requiredAttr');
|
$a = array('initValue', 'pattern', 'placeholder', 'maxlength', 'minlength', 'required', 'requiredAttr');
|
||||||
return array_merge(parent::___getConfigAllowContext($field), $a);
|
return array_merge(parent::___getConfigAllowContext($field), $a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ class InputfieldTextarea extends InputfieldText {
|
|||||||
'summary' => __('Multiple lines of text', __FILE__), // Module Summary
|
'summary' => __('Multiple lines of text', __FILE__), // Module Summary
|
||||||
'version' => 103,
|
'version' => 103,
|
||||||
'permanent' => true,
|
'permanent' => true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -182,7 +182,7 @@ class MarkupHTMLPurifier extends WireData implements Module {
|
|||||||
* See configuration options at: http://htmlpurifier.org/live/configdoc/plain.html
|
* See configuration options at: http://htmlpurifier.org/live/configdoc/plain.html
|
||||||
*
|
*
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param string $value
|
* @param string|array|mixed $value
|
||||||
* @return WireData|MarkupHTMLPurifier
|
* @return WireData|MarkupHTMLPurifier
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@@ -9,9 +9,12 @@
|
|||||||
* For more details about how Process modules work, please see:
|
* For more details about how Process modules work, please see:
|
||||||
* /wire/core/Process.php
|
* /wire/core/Process.php
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2016 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
|
* @method string execute()
|
||||||
|
* @method string ajax()
|
||||||
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -24,23 +27,27 @@ class ProcessHome extends Process {
|
|||||||
'version' => 101,
|
'version' => 101,
|
||||||
'permission' => 'page-view',
|
'permission' => 'page-view',
|
||||||
'permanent' => true,
|
'permanent' => true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ___execute() {
|
public function ___execute() {
|
||||||
$input = $this->wire('input');
|
|
||||||
|
if($this->wire()->config->ajax) return '';
|
||||||
|
|
||||||
|
$input = $this->wire()->input;
|
||||||
|
$sanitizer = $this->wire()->sanitizer;
|
||||||
$vars = array();
|
$vars = array();
|
||||||
if($input->get('login')) $vars['login'] = (int) $input->get('login');
|
|
||||||
if($input->get('layout')) $vars['layout'] = $this->wire('sanitizer')->name($input->get('layout'));
|
$login = $input->get('login');
|
||||||
$url = "page/";
|
$layout = $input->get('layout');
|
||||||
if(count($vars)) {
|
if($login) $vars['login'] = (int) $login;
|
||||||
$url .= '?';
|
if($layout) $vars['layout'] = $sanitizer->name($layout);
|
||||||
foreach($vars as $key => $value) {
|
unset($login, $layout);
|
||||||
$url .= "$key=" . $this->wire('sanitizer')->entities($value) . "&";
|
|
||||||
}
|
$url = 'page/';
|
||||||
$url = rtrim($url, '&');
|
if(count($vars)) $url .= '?' . http_build_query($vars);
|
||||||
}
|
|
||||||
$this->session->redirect($url);
|
$this->wire()->session->location($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user