Jump to content

Settings Factory


Macrura

Recommended Posts

On 10/5/2020 at 8:26 AM, gmclelland said:

@gornycreative - If you are using Cloudflare - you may want to set some rules as seen here:

 

That's good. I was early on with cloudflare and have only recently gotten back into it to see how incredible their platform has grown to.

I had a pull the levers push the buttons fire drill prior to core updates but it looks like this may help that situation a lot! Thanks.

Link to comment
Share on other sites

  • 7 months later...

There should be examples of fieldsets defined in the samples folder, but using PHP. I don't think you can do fieldsets fro JSON defined settings, but the tabs fieldsets example shows "Advanced Settings" which are each in a fieldset.

sf-_tabs_fieldsets.thumb.jpg.c6ba20ebc22ff29c936b4eaf528251c0.jpg

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
  • 1 month later...
  • 6 months later...

@Clarity

Can you post the contents of your PHP file?
Are you using any namespace?
What version of ProcessWire are you on?

There is an example settings file in the module, you can copy to your templates folder somewhere and then specify that file for the settings. If that file doesn't work, then something must have changed in the core. It works for me under PW 3.0.178.

Link to comment
Share on other sites

Thank you! Finally, I found the root of the problem. I didn't add "return $inputfields;" to the end of file.
 
I'm not using a namespace explicitly. ProcessWire version is 3.0.199 dev, and everything works fine now.
  • Like 1
Link to comment
Share on other sites

53 minutes ago, Clarity said:
Thank you! Finally, I found the root of the problem. I didn't add "return $inputfields;" to the end of file.
I'm not using a namespace explicitly. ProcessWire version is 3.0.199 dev, and everything works fine now.

awesome! Thanks for using the module - hope it helps and is useful!

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

@Clarity - Settings Factory should technically support what any module config would; i've never seen repeater fields used in a module config screen, probably because repeaters require the use of hidden pages. So for now this module would need to stay limited to those fields whose values can be stored in text/json;

  • Thanks 1
Link to comment
Share on other sites

Thank you about the information! Can you please tell whether it is possible to use ProField: Multiplier for this module? I'm getting an error "ProcessSettingsFactory: Fieldtype is not set".

  • Like 1
Link to comment
Share on other sites

On 7/15/2022 at 10:04 AM, Clarity said:

Thank you about the information! Can you please tell whether it is possible to use ProField: Multiplier for this module? I'm getting an error "ProcessSettingsFactory: Fieldtype is not set".

when you do the code to add it, you would need to specify the Fieldtype to multiply, so that needs to be one of the options,

'fieldtypeClass': 'FieldtypeText' in the json or wherever...

(haven't tested this, but looking at the module, it does need the "fieldtype to multiply" to be expressly set)

  • Like 1
Link to comment
Share on other sites

Thanks for the advice, but it doesn't work for me. The error remains the same. My settings/settings.php is like that:

<?php
 
$inputfields = array(
    array(
        "name" => "emails",
        "label" => "Emails",
        "type" => "InputfieldMultiplier",
        "fieldtypeClass" => "FieldtypeText",
        "schemaClass" => "FieldtypeText",
        "qtyMin" => 3,
        "qtyMax" => 6,
        "width" => "100",
        "description" => "",
        "collapsed" => 0,
        "placeholder" => "",
        "columnWidth" => 50
    ),
    array(
        "name" => "phones",
        "label" => "Phones",
        "type" => "InputfieldMultiplier",
        "fieldtypeClass" => "FieldtypeText",
        "schemaClass" => "FieldtypeText",
        "qtyMin" => 3,
        "qtyMax" => 6,
        "width" => "100",
        "description" => "",
        "collapsed" => 0,
        "placeholder" => "",
        "columnWidth" => 50
    )
);
 
return $inputfields;
 
Can you please say what I'm doing wrong?
Link to comment
Share on other sites

I have no idea if it will work – module config fields can't use a database table, they have to be able to store in JSON, so it would take some research and experimentation to see if it is even possible to use this field type in a module config. So setting schemaClass would have no effect.

Most module configs that use repeatable interfaces are done with custom javascript, as far as I have seen. (For example use a text field for the first one, and then a hidden field to store the repeatable values; use JS to allow the users to add an inputfield, and then join all of the values together in pipe delimited hidden field..)

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

I have a weird issue, some values aren't saved. There is no error or whatever, it actually says: Saved: Einstellungen (that's the name of my page), but after saving, the field is empty again. The same file (the php file with all the custom fields that is needed for the settings-factory to work) works on a different PW installation, but not here. Any ideas why?

EDIT: I uninstalled and reinstalled the module, now not one value gets saved on my custom settings factory page. Still with no error, just the success message: Saved: Einstellungen

Might that have to do with some php settings? Thanks for help!

Link to comment
Share on other sites

Hi @fruid - sorry to hear about this! Could you send me the PHP file to have a look at it? Also let me know your PW, PHP and MySQL versions and i'll take a look. You never know, something could have changed with the PW version or PHP 8, and we need to make sure this module keeps working!

- Marc

  • Like 1
Link to comment
Share on other sites

58 minutes ago, Macrura said:

Hi @fruid - sorry to hear about this! Could you send me the PHP file to have a look at it? Also let me know your PW, PHP and MySQL versions and i'll take a look. You never know, something could have changed with the PW version or PHP 8, and we need to make sure this module keeps working!

- Marc

hi, thanks for getting back, I think I know where the issue is, I posted about it somewhere before. The issue must be, that my page using the SettingsFactory-process is hidden. If it's hidden, it cannot save values, only if it's unhidden it can save.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...