Jump to content

Search the Community

Showing results for tags 'config'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. If your module has a lot of config fields you might want to divide them into groups inside a tabbed interface. Here is a demonstration module showing how this can be done. https://github.com/Toutouwai/ModuleConfigTabs Thanks to @kixe for providing my starting point in this forum topic.
  2. Hi all My .htaccess file is correctly redirecting all requests to https:// www. That's great until I want to work locally. I thought I had seen a blog post by Ryan where there was a new config setting to ignore both of these if working from localhost? I can't find it now so wondering if I was imagining ?
  3. Hey folks, Iam working on a module that extends InputfieldPageTable. I use PageTableExtended as a starting point and all went well so far, except I can't access my config values outside of the module file. The config values allways return the defaults, and not the values in the pw field settings. Here is the code that sets the defaults inside my inputfield module file: public function init() { parent::init(); // defaults $this->set('gridMaxWidth', '1600'); $this->set('gridColumns', '12'); } Here is how I add the config field: public function ___getConfigInputfields() { $inputfields = parent::___getConfigInputfields(); $fieldsetGrid = $this->modules->get('InputfieldFieldset'); $fieldsetGrid->label = $this->_('Default Grid Settings'); $f = $this->wire('modules')->get('InputfieldText'); $f->attr('name', 'gridMaxWidth'); $f->attr('value', $this->gridMaxWidth); $f->label = $this->_('Container max width'); $f->description = $this->_('Grid container max width in px'); // page name format description $f->notes = $this->_('default is 1600'); // page name format notes $fieldsetGrid->append($f); $inputfields->append($fieldsetGrid); return $inputfields; } Accessing the values outside my module files like this (this gives me the default: 1600, even if I insert another value in the backend field settings): $default = $this->wire('modules')->get('InputfieldPageGrid'); $default->gridMaxWidth; Any Ideas?
  4. I'm trying to migrate a PW site on my local dev server to a shared hosted server and have used the ProcessExportProfile module to export a profile as a zip file. So far so good. I then deploy new install of PW on the server by unzipping the PW installation files but I do not run the install until I have replaced the various site profiles with the files from the exported profile. So basically: In the PW install files I delete all the site-* folders except site-default. This one I overwrite with the export profile folders so it contains my assets, install, modules and templates folders together with the exported config.php I then run the install in the browser in the normal way and it starts the installation and I can see my website profile in the list and I select it. It proceeds as normal and gets to setting up the database. I provide the db info. as usual and it proceeds as far the info. below and 'hangs' at this point , it never goes on to setup the PW login admin. and complete the install I am left at that screen. If I relaunch the browser at the site it all seems to work! BUT I have no admin login to PW so cannot get into the backend. I have basically followed the Installation, Moving and Troubleshooting guide by Joss Sanglier: http://processwire.com/docs/tutorials/installation-moving-and-troubleshooting/page4 Any idea where I could check for an error log or some help as I am at a loss as to the problem. Many thanks. Paul ProcessWire 3.x Installer Test Database and Save Configuration Database connection successful to pinpoin1_master Saved configuration to ./site/config.php Profile Import Imported database file: ./wire/core/install.sql Imported database file: ./site/install/install.sql
  5. Just a quick one. Is it possible to move my prependTemplateFile to a subdirectory with templates? setting $config->prependTemplateFile = 'includes/_init.php' doesn't work for me
  6. Hell, Although I use a config on an other of my sites that works well. An error 500 is driving me nuts. Coul someone have a look on my config server { listen 80; server_name attente.xyz; rewrite ^ https://$server_name$request_uri? permanent; } server { listen 443 ssl; server_name attente.xyz; ssl_certificate /etc/letsencrypt/live/krouus.company/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/krouus.company/privkey.pem; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Activer le ciphers et mettre ceux autorisés (je vous laisse faire de plus amples recherches pour ça ;) ) ssl_prefer_server_ciphers on; ssl_ciphers 'DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-CAMELLIA256-SHA:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-CAMELLIA128-SHA:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA256'; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; # La fameuse clé générée en dernier ssl_dhparam /etc/nginx/dhparam.pem; # Ajout d'une règle http add_header Strict-Transport-Security "max-age=31536000;"; root /var/www/attente.xyz/html; index index.php index.html index.htm; location / { # try_files $uri $uri/ /index.php?it=$uri&$args; try_files $uri /index.php$is_args$args; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors on; fastcgi_ignore_client_abort off; fastcgi_connect_timeout 60; fastcgi_send_timeout 180; fastcgi_read_timeout 180; fastcgi_buffers 4 256k; fastcgi_buffer_size 128k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; } location ~ \.php$ { #try_files $uri =404; include snippets/fastcgi-php.conf; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # .htaccess 10. fastcgi_param HTTP_MOD_REWRITE On; fastcgi_param X-Real-IP $remote_addr; fastcgi_param X-Forwarded-For $remote_addr; fastcgi_param Host $host; } location ~* \.(?:css|gif|htc|ico|js|jpe?g|png|swf|svg|ttf|eot|woff|less|pdf)$ { #expires max; log_not_found off; ## No need to bleed constant updates. Send the all shebang in one ## fell swoop. tcp_nodelay off; ## Set the OS file cache. open_file_cache max=1000 inactive=120s; open_file_cache_valid 45s; open_file_cache_min_uses 2; open_file_cache_errors off; valid_referers attente.xyz; ##ajout ProcessWire expires 24h; #log_not_found off; access_log off; try_files $uri /index.php?it=$uri&$args; } # .htaccess 8.1 charset utf-8; # .htaccess 3. location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; } # .htaccess 4. # add_header X-Frame-Options SAMEORIGIN always; # Set by ProcessWire core add_header X-XSS-Protection "1; mode=block"; # add_header X-Content-Type-Options "nosniff"; # ----------------------------------------------------------------------------------------------- # .htaccess 5. # ----------------------------------------------------------------------------------------------- # Block access to ProcessWire system files location ~ \.(inc|info|info\.json|module|sh|sql)$ { deny all; } # Block access to composer files location ~ composer\.(json|lock)$ { deny all; } # Block access to any file or directory that begins with a period (except well-known) location ~ (^|/)\.(?!well-known)|^\..*$ { deny all; } # ----------------------------------------------------------------------------------------------- # .htaccess 15. # ----------------------------------------------------------------------------------------------- # Block access to protected assets directories location ~ ^/(site|site-[^/]+)/assets/(cache|logs|backups|sessions|config|install|tmp)($|/.*$) { deny all; } # Block acceess to the /site/install/ directory location ~ ^/(site|site-[^/]+)/install($|/.*$) { deny all; } # Block dirs in /site/assets/ dirs that start with a hyphen location ~ ^/(site|site-[^/]+)/assets.*/-.+/.* { deny all; } # Block access to /wire/config.php, /site/config.php, /site/config-dev.php, and /wire/index.config.php location ~ ^/(wire|site|site-[^/]+)/(config|index\.config|config-dev)\.php$ { deny all; } # Block access to any PHP-based files in /templates-admin/ location ~ ^/(wire|site|site-[^/]+)/templates-admin($|/|/.*\.(php|html?|tpl|inc))$ { deny all; } # Block access to any PHP or markup files in /site/templates/ location ~ ^/(site|site-[^/]+)/templates($|/|/.*\.(php|html?|tpl|inc))$ { deny all; } # Block access to any PHP files in /site/assets/ location ~ ^/(site|site-[^/]+)/assets($|/|/.*\.php)$ { deny all; } # Block access to any PHP files in core or core module directories location ~ ^/wire/(core|modules)/.*\.(php|inc|tpl|module)$ { deny all; } # Block access to any PHP files in /site/modules/ location ~ ^/(site|site-[^/]+)/modules/.*\.(php|inc|tpl|module)$ { deny all; } # Block access to any software identifying txt files location ~ ^/(COPYRIGHT|INSTALL|README|htaccess)\.(txt|md)$ { deny all; } # Block all http access to the default/uninstalled site-default directory location ~ ^/site-default/ { deny all; } } Thank you for any hunch.
  7. I always seem to get this warning on every new install of PW on my Ubuntu 14 box with Digital Ocean. The servers are usually based in the UK and I was wondering if I should be adding something other than the below in the config? Is there a UK based locale code? Quick Google didnt come up with much. Warning: your server locale is undefined and may cause issues. Please add this to /site/config.php file (adjust “en_US.UTF-8” as needed): setlocale(LC_ALL,'en_US.UTF-8'); Added to the config file: setlocale(LC_ALL,'en_US.UTF-8');
  8. Hello, I discovered processwire a couple of days ago and I am very impressed so now I am integrating it with the Yii framework (once complete I'll post a tutorial with code), so far it is going well but I do seem to have a problem with setting a new path for a $page->template->filename. Setting $config->paths->templates in the PW config.php file works fine but I want to be able to set Yii-specific config variables after I have included the PW index.php. I assumed that by setting $wire->config->paths->templates that this would be reflected in $page->template->filename but that doesn't seem to be the case. Is this a bug or am I confused? Any advice greatly appreciated.
  9. I have one central website, with membership registration and content etc., and then several related websites with their own URL/domains, each on Processwire, all on the same server. I would like to access the database of the central website from the sister websites. How would I do that? You can't bootstrap one PW installation into another. You can include template parts from one in the other by just using the server path, but whatever you try to get/post just comes/goes to the database of the site you are on. Could you switch databases by including the config.php from another PW installation somewhere? What is the correct, secure way to do this?
  10. Hi all, Is there a way to turn off fatal error notification without nullifying or commenting out: $config->adminEmail Thx Rudy
  11. Hi all, Just wondering if its possible to just add some basic output to my modules config page. I was wanting to output a bulleted list of some information which I will be pulling from a third party. Retrieving the data is fine i'm just not sure how to output it to the config page? From what I can see in the link below, it only seems like you can append form items to the page. https://processwire.com/blog/posts/new-module-configuration-options/
  12. Maybe I'm missing something here, but I'm haveing a hard time to get absolute urls if PW is installed in a subdirectory thought the API... I need an absolute URL for the backend (as a redirect url of Oauth provider). To build the url i would normaly use url()->root.url()->admin – but this results in the install-path beeing present twice; domain.com/path/ + path/admin/ In order to not use $_SERVER['HTTP_HOST'] I fetch the admin page from pages – but this is also not to easy since I need to remove the root folder from path as well. My current solution is somewhat complicated: $backendUrl = pages()->get('path="'.str_replace(urls()->root, '', urls()->admin).'", include=all')->httpUrl; The above code seems to be the savest way to get the absolute url to the backend using pure PW API, am I right? It would be great if one could fetch absolute urls with something like this $backendUrl = urls()->admin->httpUrl // or $backendUrl = httpUrls()->admin SOLVED: Thank you @adrian – of course this HAD to be simpler: urls()->httpAdmin;
  13. Hello, I've been developing a general settings module for our websites. I'm storing the settings data in the module config data, but I can't seem to get the data working at the front-end of our website. I'm trying to call the data in my template like this: modules()->getConfig('TypoSettings'); Wich returns me an empty array. Am I doing something wrong? Or has it something to do with module permissions? Full module code: <?php namespace ProcessWire; /* * TypoSettings */ class TypoSettings extends Process implements Module, ConfigurableModule { public static function getModuleInfo() { return array( 'title' => "TypoSettings", 'version' => "0.0.1", 'summary' => "An awesome module for saving your general site settings.", 'author' => "Jonathan Claeys", 'href' => "", 'icon' => "cog", 'autoload' => false, 'singular' => true, 'requires' => "ProcessWire>=2.5", "permissions" => array( "setting-view" => "View the general sitewide settings.", "setting-edit" => "Edit the general sitewide settings." ), ); } public function init(){ modules()->get('JqueryWireTabs'); parent::init(); } public function ___execute(){ return $this->createForm($this->getDefaultData()); } static public function getDefaultData(){ return array( /* * General */ 'settings_general_tab' => array( 'type' => 'InputfieldTab', 'label' => __('General') ), 'settings_client' => array( 'type' => 'InputfieldText', 'label' => __('Client'), 'value' => 'Typografics', 'required' => 1 ), 'settings_email' => array( 'type' => 'InputfieldEmail', 'label' => __('E-mail'), 'value' => 'info@typografics.be', 'required' => 1 ), 'settings_telephone' => array( 'type' => 'InputfieldText', 'label' => __('Telephone'), 'value' => '', 'required' => 0 ), 'settings_fax' => array( 'type' => 'InputfieldText', 'label' => __('Fax'), 'value' => '', 'required' => 0 ), 'settings_general_tab_end' => array( 'type' => 'InputfieldTabEnd' ), /* * Location */ 'settings_location_tab' => array( 'type' => 'InputfieldTab', 'label' => __('Location') ), 'settings_address' => array( 'type' => 'InputfieldText', 'label' => __('Address'), 'value' => 'Zwaarveld 45', 'required' => 1 ), 'settings_postal_code' => array( 'type' => 'InputfieldText', 'label' => __('Postal code'), 'value' => '9220', 'required' => 1, 'columnWidth' => 33 ), 'settings_city' => array( 'type' => 'InputfieldText', 'label' => __('City'), 'value' => 'Hamme', 'required' => 1, 'columnWidth' => 67 ), 'settings_location_tab_end' => array( 'type' => 'InputfieldTabEnd' ), /* * Social media */ 'settings_social_tab' => array( 'type' => 'InputfieldTab', 'label' => __('Social media') ), 'settings_facebook' => array( 'type' => 'InputfieldText', 'label' => __('Facebook'), 'value' => '', 'required' => 0 ), 'settings_linkedin' => array( 'type' => 'InputfieldText', 'label' => __('LinkedIn'), 'value' => '', 'required' => 0 ), 'settings_google_plus' => array( 'type' => 'InputfieldText', 'label' => __('Google Plus'), 'value' => '', 'required' => 0 ), 'settings_twitter' => array( 'type' => 'InputfieldText', 'label' => __('Twitter'), 'value' => '', 'required' => 0 ), 'settings_pinterest' => array( 'type' => 'InputfieldText', 'label' => __('Pinterest'), 'value' => '', 'required' => 0 ), 'settings_instagram' => array( 'type' => 'InputfieldText', 'label' => __('Instagram'), 'value' => '', 'required' => 0 ), 'settings_social_tab_end' => array( 'type' => 'InputfieldTabEnd' ), ); } public function __construct(){ foreach (self::getDefaultData() as $key => $value) { $this->$key = $value; } } static public function getModuleConfigInputfields(array $data) { $defaults = self::getDefaultData(); $data = array_merge($defaults, $data); $fields = new InputfieldWrapper(); foreach($data as $key => $inputfield){ if (!isset($inputfield['type'])) { continue; } switch ($inputfield['type']){ case 'InputfieldTab': break; case 'InputfieldTabEnd': break; default: $field = modules()->get($inputfield['type']); $field->attr('id+name', $key); $field->label = $inputfield['label']; $field->required = $inputfield['required']; $field->value = $data[$key]['value']; $fields->append($field); } } return $fields; } public function createForm($inputfields){ /* * Create form */ $form = $this->modules->get('InputfieldForm'); $form->action = './'; $form->method = 'post'; $form->attr('id+name', 'TypoSettings'); /* * Add inputfields */ $data = modules()->getConfig('TypoSettings'); foreach($inputfields as $key => $inputfield){ switch ($inputfield['type']){ case 'InputfieldTab': $tab = new InputfieldWrapper(); $tab->attr("title", $inputfield['label']); break; case 'InputfieldTabEnd': $form->append($tab); unset($tab); break; default: $field = modules()->get($inputfield['type']); $field->attr('id+name', $key); $field->label = $inputfield['label']; $field->required = $inputfield['required']; if(isset($inputfield['columnWidth'])){ $field->columnWidth = $inputfield['columnWidth']; } $field->value = (isset($data[$key]) ? $data[$key] : $inputfield['value']); $tab->append($field); } } /* * Add submit */ $submit = modules()->get("InputfieldSubmit"); $submit->attr("value", __("Save")); $submit->attr("id+name","submit"); $form->append($submit); /* * Process form */ if(input()->post->submit){ $data = modules()->getConfig('TypoSettings'); foreach($this->getDefaultData() as $key => $inputfield){ if($inputfield['type'] != 'InputfieldTab' && $inputfield['type'] != 'InputfieldTabEnd'){ if($inputfield['required'] && empty(input()->post->{$key})){ page()->error(sprintf(__('%1$s is a required field. (%2$s field was not updated)'), $inputfield['label'], $inputfield['label'])); }else{ $data[$key] = input()->post->{$key}; } } } modules()->saveConfig('TypoSettings', $data); page()->message($this->_('Saved Settings')); session()->redirect(page()->url); }else{ $out = $form->render(); } return $out; } const modulePage = 'settings'; const permissionView = 'setting-view'; const permissionEdit = 'setting-edit'; public function ___install(){ $page = $this->pages->get('template=admin,name='.self::modulePage); if (!$page->id) { $page = new Page(); $page->template = $this->templates->get('admin'); $page->parent = $this->pages->get($this->config->adminRootPageID); $page->title = 'Settings'; $page->name = self::modulePage; $page->process = $this; $page->save(); } $permissionView = $this->permissions->get(self::permissionView); if (!$permissionView->id){ $permissionView = new Permission(); $permissionView->name = self::permissionView; $permissionView->title = $this->_('View the general sitewide settings.'); $permissionView->save(); } $permissionEdit = $this->permissions->get(self::permissionEdit); if (!$permissionEdit->id){ $permissionEdit = new Permission(); $permissionEdit->name = self::permissionEdit; $permissionEdit->title = $this->_('Edit the general sitewide settings.'); $permissionEdit->save(); } } public function ___uninstall() { $page = $this->pages->get('template=admin, name='.self::modulePage); if ($page->id) { $page->delete(); } $permissionView = $this->permissions->get(self::permissionView); if ($permissionView->id){ $permissionView->delete(); } $permissionEdit = $this->permissions->get(self::permissionEdit); if ($permissionEdit->id){ $permissionEdit->delete(); } } }
  14. To me, saving database credentials to a Git repository, even if that repo is private, is a big no-no. So I've been tinkering with different ways to deploy sites to production environments without saving the database credentials to the repo. I know that there is a the config-dev.php option. But that hasn't worked for me, as I will explain later. I added this to my config.php: $config->env = "dev"; if($config->env == "dev") { $config->dbHost = 'localhost'; $config->dbName = 'processwire'; $config->dbUser = 'root'; $config->dbPass = 'root'; $config->dbPort = '3306'; } else { require("./{$config->env}.config.php"); } So if $config->env = "production", production.config.php should be loaded: $config->dbHost = 'localhost'; $config->dbName = 'processwire-production'; $config->dbUser = 'username'; $config->dbPass = 'productionPassWord'; $config->dbPort = '3306'; I can't see anything wrong with the syntax of this at all - but for some reason, if that file is added with require() or require_once(), ProcessWire never loads. If it's loaded with include(), I get an error about the page not being found, and there being no install.php present. So it seems like for some reason, there is no way to include a file in config.php, which confuses me immensely. How my brain works I'll try to explain my thought process behind this a little more. I think it's a good idea for dev environments (especially those that come with a Vagrant box and a defined database already installed) to include dev-level database creds. It should just work. If someone works on this site after me, they shouldn't have to spend a ton of time getting a config file set up. Secondly, having a config.php file and a config-dev.php file frustrates me because for the developer that comes after me, they could really use the config-dev file! But if it's in the repo, it gets deployed. If it gets deployed, it gets called on the staging/production server, and that is no good! Also, config.php and config-dev.php would in most cases pretty much completely mirror one another with the exception of database creds, and maybe debug or a few other things. That is why I want to have all the configs in the repo within config.php except for the tiny bits that are environment-specific. They should be able to be included, right?
  15. With Microsoft Azure recently releasing proper Linux and native Mysql hosting, it is becoming very easy to get processwire hosted on that platform. By default, they force SSL connection to the managed Mysql server. This causes processwire to fail when trying to connect. I can turn off SSL for my MySql server, but I wish there was a $config setting like $config->useSSL = true that would allow processwire to include the appropriate property in the connection string (like ssl=true or whatever). Here is the Azure link that explains what I would like to do: https://docs.microsoft.com/en-us/azure/mysql/concepts-ssl-connection-security Am I missing this config setting somewhere? Or would it be easy to add? Thanks.
  16. Do any experts have experience with the level of stability and/or support for turning on $config->advanced? I ask because of the warning at the bottom of the System tab "Please note that all of these system settings are intended for ProcessWire system development (not site development). Use them at your own risk." It provides two facilities that are invaluable to me (maybe because I don't know how to do them any other way). 1) Disable Settings Tab on a per template basis 2) Page Class Name - this makes it tweak a page while relying on the underlying Page class for the majority of functions. Are others using this setting in production? Have you used it over an extended time and seen that it is not changed often or at all?
  17. I installed a module and noticed that the "Installed Date" in Module Information showed "2 hours from now". I also noticed that after I modified a page, the "Last Modified Date" showed the date and time, plus in parenthesis "2 hours from now". I am in Eastern (New York) time, the server is in Central (Dallas) time, and the physical location of the entity for whom I built the site in in Pacific (Los Angeles) time. When I installed the site, I changed the timezone to Los Angeles (if I recall correctly, it defaulted to Dallas), so now in my config file I have: $config->timezone = 'America/Los_Angeles'; My question is twofold: 1. Should $config->timezone correspond to the servers timezone, or my (or the client's) timezone? 2. Is there any problem if it's set incorrectly? Thanks!! PW 3.0.42
  18. I'm using this piece of code to add a table layout to my module configuration: $this ->wire('modules') ->get('MarkupAdminDataTable') Then I use this to add rows to my table: $this ->wire('modules') ->get('MarkupAdminDataTable') ->row($data) But when I try to add a field to my table, It's not rendered as a field, I only see the the classname of the input field instead of the field itself. Is it possible to render a field into a table row?
  19. In my module's getModuleConfigInputfields method, I've added a field of type: InputfieldButton. I want this button have a different action than the usual submit button (which is still there) and the submit button to behave as it always does. For example; I want the InputfieldButton button to clear a few folders when it's clicked. Is this possible, if so, how can I achieve this?
  20. I've added a hook after the '"ProcessPageEdit::buildFormContent" event. I've added a new config option to the language settings: public function beforeAdminProcessPageEditBuildFormContent (HookEvent $event) { $editPage = $this->getPage(wire('input')->get('id')); if ($editPage->template->name == 'language') { // only add field when editing language page $field = wire('modules')->get('InputfieldText'); $field->attr('name+id', 'locale'); $field->label = __('Locale'); $event->return->insertAfter($field, $event->return->getChildByName('title')); } } I've also created a field (Setup > Fields > Add new) which I've also named 'locale'. The field is displayed, but the value isn't saved when I click the save button. How do I make sure the input of the field is saved as well? And how can I access the stored value once it's saved?
  21. Hi all. I need to change $config->paths->data['templates'] value from "templates" to "m_templates" for example. I think this wil be more easy to use specific folder for mobile view. How to change depending on some actions? (detecting if site viewing on mobile browser) Thanks
  22. Hello, I'm struggling to access module config values inside init() or ready(). My module extends InputfieldCheckboxes and implements Module interface. I have a custom configuration field public function ___getConfigInputfields() { $inputfields = parent::___getConfigInputfields(); $modules = $this->wire('modules'); $options = $this->getInputfieldCheckboxes(); $f = $modules->get('InputfieldSelect'); $f->attr('name', 'targetField'); $f->set('label', $this->_('Choose the target checkboxes field')); $f->set('description', $this->_('The field that has checkboxes which depend on this field\'s checkboxes')); // $f->set('notes', $this->_('Types indicated with an asterisk are for multiple field selection.')); foreach ($options as $fieldName => $prop) $f->addOption($fieldName, $prop['label']); $f->attr('value', $this->targetField); $inputfields->add($f); return $inputfields; } This is working fine and saving values. Right after getModuleInfo() I have public function __construct() { parent::__construct(); $this->set('targetField', ''); } In my render() and getConfigInputfields() methods, I can access the value for the custom config setting with $this->targetField. But in other methods, it is not available. In the API Reference for init() it says: When I remove my __construct() method entirely, config values still get saved correctly. But when I access $this->targetField in init() or ready(), I get null. How can I access configuration data inside init() or ready() ? I read many posts and looked at how other modules do this. But couldn't find a solution. Thanks in advance for any pointers.
  23. Hi, I tried to disable it in my site/modules/InputfieldCKEditor/config-body.js CKEDITOR.editorConfig = function( config ) { config.plugins.image = 0; config.plugins.pwimage = 0; console.log('CKEDITOR.editorConfig executed'); }; I made sure that the function is executed by that console.log call, but the image button is still there. Thanks! Edit: Removing the plugin like suggested here, doesn't do it either: CKEDITOR.editorConfig = function( config ) { config.removePlugins = 'image,pwimage'; // OR: config.removePlugins = 'pwimage'; // OR: config.removePlugins = 'image'; };
  24. Is it possible to create tabs for settings in module?
  25. Need your kindly tips and guidance: So I need for the configuration to have a field for every existing [template=]supplier, for matching with a dir (not already matched) within the module directory which contains the import & update scripts for that supplier. Then on the admin page created by this module under Admin > Setup, all of the Suppliers need to be listed with corresponding links to Import or Update where available (for those matched to a directory); and when one of those actions is executed it should load the results log in an iframe. But, how? Here is what I have so far, yet to try activated: <?php /** * Process Products Data (0.0.1) * Scrapes imports products, and updates pricing, availability variations synchronized with data feeds. Process tailored per source account/supplier. * * @author * * ProcessWire 3.x * Copyright (C) 2011 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class ImportProductsData extends Process implements ConfigurableModule { public static function getModuleInfo() { return array( 'title' => "Process Products Data", 'version' => "0.0.1", 'summary' => "Scrapes &amp; imports products, and updates pricing, availability &amp; variations synchronized with data feeds. Process tailored per source account/supplier.", 'permission' => array(""), 'autoload' => false, 'singular' => true, 'permanent' => false, 'permission' => 'products-impupd', 'requires' => array("PHP>=5.4.0", "ProcessWire>=2.5.28", ""), //'installs' => array(""), ); } const PAGE_NAME = 'products-impupd'; static public function getDefaults() { return array( ); } public function init() { // $this->addStyle("custom.css"); // $this->addScript("custom.js"); // $this->addHookAfter("class::function", $this, "yourFunction"); } public function ___install() { // Create page "Product Data ImpUpd" under Setup $page = $this->pages->get('template=admin, name='.self::PAGE_NAME); if (!$page->id) { $page = new Page(); $page->template = 'admin'; $page->parent = $this->pages->get($this->config->adminRootPageID)->child('name=setup'); $page->title = 'Products Import&amp;Update'; $page->name = self::PAGE_NAME; $page->process = $this; $page->save(); // tell the user we created this page $this->message("Created Page: {$page->path}"); } } public function ___uninstall() { // Del page ImpUpd under Setup //$moduleID = $this->modules->getModuleID($this); $page = $this->pages->get('template=admin, name='.self::PAGE_NAME); if($page->id) { // if we found the page, let the user know and delete it $this->wire('pages')->delete($page, true); $this->message($this->_('Deleted Page: ') . $page->path); } } static public function getModuleConfigInputfields(array $data) { $inputfields = new InputfieldWrapper(); $defaults = self::getDefaults(); $data = array_merge($defaults, $data); return $inputfields; // foreach supplier select data set dir (each w/ import & update fct) // defaults = supplier.name // once selected execute import or update & log // in iframe & display results [log] } }
×
×
  • Create New...