MyComponent password type system settings can't be edited

I don’t see how I could have bungled this

This is the relevant part of the config:

    'newSystemSettings' => array(
        'hcaptcha.site_key' => array( // key
            'key' => 'hcaptcha.site_key',
            'name' => 'hCaptcha: Site Key',
            'description' => 'Site key for the site generated from the hCaptcha dashboard.',
            'namespace' => 'hcaptcha',
            'xtype' => 'textfield',
            'value' => 'site key goes here',
            'area' => '',
        ),
        'hcaptcha.secret_key' => array( // key
            'key' => 'hcaptcha.secret_key',
            'name' => 'hCaptcha: Secret Key',
            'description' => 'Secret key for your hCaptcha account',
            'namespace' => 'hcaptcha',
            'xtype' => 'password',
            'value' => 'secret key goes here',
            'area' => '',
        ),
    ),

The textfield works fine, but the password one shows the pencil to edit but doesn’t do anything when you double click.

Does it work if you use text-password as the xtype?

Nope, that didn’t do it. Unless the system settings aren’t updated when you install a new version over the old one? I’m just using the upload a package option in the extras installer

Maybe check the value of the column xtype for the system setting directly in the database table modx_system_settings, to see if it got updated.

The x-type set in the config file should definitely be text-password.

Remember that ImportObjects does not update System Settings. So if you modify the config file for them, you have to delete the existing setting and run Bootstrap.

I think it would also work to change the setting type to something else in the Manager, then back to password. Then run ExportObjects to update the transport file.

I read through the docs and I don’t think I understand the workflow. Is there a flow chart or something that isn’t so information heavy?

Like I have the config updated, and I make updates to one of the snippets, what do I have to do to update everything? Is it just hitting ExportObjects that will update everything?

I updated the config to use text-password and it is still not able to be edited by double clicking. The name is also not right, i thought it would be hcaptcha.site_key but it is showing up as site_key

What do you see in the xtype field for that System Setting in the DB?

The name and description fields for settings are handled in a weird way. In fact, there is no name or description field in the System Settings table in the DB. They are automatically generated keys that are based on the key of the setting. They don’t exist outside the process of rendering the panel, but they look like this for a setting with a key of greeting:

setting_greeting
setting_greeting_description

In the default.inc.php lexicon file, you’d see something like this:

$_lang['setting_greeting'] = 'Greeting';
$_lang['setting_greeting_description'] = 'This is the greeting'

When MODX loads the System Setting edit panel, it uses the setting’s key to generate the two keys for the name and description, looks those keys up in the lexicon file, and puts the values found there on the screen in those two fields.

In your config file, you usually want simpler values, since that’s what the user will see. They can see the key and they know what settings they’re looking at (just a suggestion). Prefixes are unnecessary since MODX will only be looking in your own lexicon file, so there’s no need to mix dots and underscores (which, might confuse you later on).

            'key' => 'hcaptcha_site_key',
            'name' => 'Site Key',
            'description' => 'Site key for the site generated from the hCaptcha dashboard.', 

            'key' => 'hcaptcha_secret_key',
            'name' => 'Secret Key',
            'description' => 'Secret key for your hCaptcha account',

Whatever you do, make sure the key and description fields match the keys in the default.inc.php lexicon file.

As for workflows, there is a diagram [here], (Bob's Guides | MyComponent Workflow), but I don’t know if it will help. It’s difficult because MyComponent is so complex (it’s now made up of over 3,500 files) and powerful, and I tried to make it fit a variety of workflows.

There are basically three possible workflows:

  1. Work on the files and import them with ImportObjects
  2. Work on the objects in the Manager and export them with ExportObjects
  3. Switch back and forth between 1 and 2

Number one doesn’t really work by itself because ImportObjects doesn’t update everything, and some objects have no code files. Number two can work by itself, but if you have a good code editor, you’ll miss it when editing code in the Manager.

Number 3 is what I do, but you have to be careful to run ImportObjects or ExportObjects before switching methods.