From 3fc952f674a29eeafd9f2498aba1e4505757316b Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Thu, 20 Apr 2023 12:24:40 -0400 Subject: [PATCH] Other minor unrelated updates --- wire/core/WireMail.php | 2 +- wire/core/WireMailTools.php | 6 +++--- .../modules/Fieldtype/FieldtypeTextareaHelper.php | 7 ++++++- .../LanguageSupport/LanguageSupportInstall.php | 15 +++++++++------ .../Process/ProcessField/ProcessField.module | 3 +-- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/wire/core/WireMail.php b/wire/core/WireMail.php index 61a31113..f3bec703 100644 --- a/wire/core/WireMail.php +++ b/wire/core/WireMail.php @@ -550,7 +550,7 @@ class WireMail extends WireData implements WireMailInterface { if(is_null($value)) { $this->mail['attachments'] = array(); } else if(is_file($value)) { - $filename = $filename ?: basename($value); + $filename = $filename ? basename($filename) : basename($value); $this->mail['attachments'][$filename] = $value; } return $this; diff --git a/wire/core/WireMailTools.php b/wire/core/WireMailTools.php index c813b150..15950d88 100644 --- a/wire/core/WireMailTools.php +++ b/wire/core/WireMailTools.php @@ -384,9 +384,9 @@ class WireMailTools extends Wire { return $this->new()->subject($subject); } - public function __get($key) { - if($key === 'new') return $this->new(); - return parent::__get($key); + public function __get($name) { + if($name === 'new') return $this->new(); + return parent::__get($name); } /** diff --git a/wire/modules/Fieldtype/FieldtypeTextareaHelper.php b/wire/modules/Fieldtype/FieldtypeTextareaHelper.php index bab3a0eb..19617a4f 100644 --- a/wire/modules/Fieldtype/FieldtypeTextareaHelper.php +++ b/wire/modules/Fieldtype/FieldtypeTextareaHelper.php @@ -51,6 +51,11 @@ class FieldtypeTextareaHelper extends Wire { $f->label = $this->_('Inputfield Type'); $f->description = $this->_('The type of field that will be used to collect input (Textarea is the default). Note that if you change this and submit, the available configuration options in the "input" tab section may change.'); // Inputfield type description $f->required = true; + $f->notes = $this->_('We recommend using TinyMCE over CKEditor when creating new rich text fields.'); + if(!$modules->isInstalled('InputfieldTinyMCE')) { + $installUrl = $modules->getModuleInstallUrl('InputfieldTinyMCE'); + $f->notes .= ' [' . $this->_('Click here to install TinyMCE') . "]($installUrl)"; + } $baseClass = "InputfieldTextarea"; foreach($modules->find("className^=Inputfield") as $fm) { @@ -270,7 +275,7 @@ class FieldtypeTextareaHelper extends Wire { public function getInputfieldError(Field $field) { $config = $this->wire()->config; - $editURL = $config->urls->admin . "setup/field/edit?id=$field->id"; + $editURL = $field->editUrl(); $modulesURL = $config->urls->admin . "module/"; $inputfieldClass = $field->get('inputfieldClass'); $findURL = "https://processwire.com/search/?q=$inputfieldClass&t=Modules"; diff --git a/wire/modules/LanguageSupport/LanguageSupportInstall.php b/wire/modules/LanguageSupport/LanguageSupportInstall.php index b9e7f999..4d4193ed 100644 --- a/wire/modules/LanguageSupport/LanguageSupportInstall.php +++ b/wire/modules/LanguageSupport/LanguageSupportInstall.php @@ -288,6 +288,7 @@ class LanguageSupportInstall extends Wire { * */ public function getModuleConfigInputfields() { + $modules = $this->wire()->modules; $install = $this->_('Click to install:') . ' '; $form = $this->wire(new InputfieldWrapper()); @@ -300,17 +301,17 @@ class LanguageSupportInstall extends Wire { $list = array(); foreach($names as $name) { - if($this->wire('modules')->isInstalled($name)) continue; - $list["./installConfirm?name=$name"] = "$install $name"; + if($modules->isInstalled($name)) continue; + $list[$modules->getModuleInstallUrl($name)] = "$install $name"; $installed[$name] = true; } $list["../setup/languages/"] = $this->_('Add and configure new languages'); - $title = $this->wire('fields')->get('title'); + $title = $this->wire()->fields->get('title'); if($title && strpos($title->type->className(), 'Language') === false) { - $list["../setup/field/edit?id=$title->id"] = + $list[$title->editUrl()] = $this->_('Change the type of your "title" field from "Page Title" to "Page Title (Multi-language)"') . ' *'; } @@ -320,8 +321,10 @@ class LanguageSupportInstall extends Wire { $this->_('Change the type of any other desired "Textarea" fields to "Textarea (Multi-language)"') . ' *'; if(count($list)) { - $this->wire('modules')->get('JqueryUI')->use('modal'); - $f = $this->wire('modules')->get('InputfieldMarkup'); + $jQueryUI = $modules->get('JqueryUI'); /** @var JqueryUI $jQueryUI */ + $jQueryUI->use('modal'); + /** @var InputfieldMarkup $f */ + $f = $modules->get('InputfieldMarkup'); $f->attr('name', '_next_steps'); $f->label = $this->_('Next steps'); $f->value = "