diff --git a/wire/modules/LanguageSupport/LanguageSupport.module b/wire/modules/LanguageSupport/LanguageSupport.module index e263ff9b..1f1ef44d 100644 --- a/wire/modules/LanguageSupport/LanguageSupport.module +++ b/wire/modules/LanguageSupport/LanguageSupport.module @@ -830,11 +830,12 @@ class LanguageSupport extends WireData implements Module, ConfigurableModule { * @return InputfieldWrapper * */ - public static function getModuleConfigInputfields(array $data) { - if($data) {} - $form = new InputfieldWrapper(); - // TBA - return $form; + public function getModuleConfigInputfields(array $data) { + if($data) { } + require(dirname(__FILE__) . '/LanguageSupportInstall.php'); + /** @var LanguageSupportInstall $installer */ + $installer = $this->wire(new LanguageSupportInstall()); + return $installer->getModuleConfigInputfields(); } /** diff --git a/wire/modules/LanguageSupport/LanguageSupportInstall.php b/wire/modules/LanguageSupport/LanguageSupportInstall.php index df87d9cc..a230e510 100644 --- a/wire/modules/LanguageSupport/LanguageSupportInstall.php +++ b/wire/modules/LanguageSupport/LanguageSupportInstall.php @@ -276,4 +276,61 @@ class LanguageSupportInstall extends Wire { } } + + + /** + * @return InputfieldWrapper + * + */ + public function getModuleConfigInputfields() { + $install = $this->_('Click to install:') . ' '; + + $form = new InputfieldWrapper(); + $names = array( + 'LanguageSupportFields', + 'LanguageSupportPageNames', + 'LanguageTabs', + ); + $installed = array(); + $list = array(); + + foreach($names as $name) { + if($this->wire('modules')->isInstalled($name)) continue; + $list["./installConfirm?name=$name"] = "$install $name"; + $installed[$name] = true; + } + + $list["../setup/languages/"] = + $this->_('Add and configure new languages'); + + $title = $this->wire('fields')->get('title'); + if($title && strpos($title->type->className(), 'Language') === false) { + $list["../setup/field/edit?id=$title->id"] = + $this->_('Change the type of your "title" field from "Page Title" to "Page Title (Multi-language)"') . ' *'; + } + + $list["../setup/field/?fieldtype=FieldtypeText"] = + $this->_('Change the type of any other desired "Text" fields to "Text (Multi-language)"') . ' *'; + $list["../setup/field/?fieldtype=FieldtypeTextarea"] = + $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'); + $f->attr('name', '_next_steps'); + $f->label = $this->_('Next steps'); + $f->value = ""; + $f->description = + $this->_('To continue setting up multi-language support, we recommend the following next steps.') . ' ' . + $this->_('The links below will open in a new window/tab. Close each after finishing to return here.'); + $f->notes = '*' . $this->_('Install the LanguageSupportFields module before attempting to change text field types.'); + $form->add($f); + } + + return $form; + } }