Zen Cart Logo
Forums / Bug Reports / [Not a bug] Configuration 'use_function' called for display instead of update

[Not a bug] Configuration 'use_function' called for display instead of update

Locked

Views: 774

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
14 Nov 2012, 4:10 PM
#1
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

[Not a bug] Configuration 'use_function' called for display instead of update

Background
For some configuration options (for a plugin), I would like to call a function when the value is "updated" and only when the value is "updated". I'd like to use the built-in configuration system if possible for these options. While working with the field I noted a discrepancy between the wiki documentation and the code in configuration.php. So a "bug" of sorts in one place or the other.

Question
From the wiki documentation the function listed in the 'use_function' column is run on input by the user before changing 'configuration_value'. Based upon this I would expect the function to only be called when the "update" button is clicked. Is this the expected behavior (or outdated documentation)?

Looking at 'admin/configuration.php' this file runs the 'use_function' before displaying any configuration options / values instead of when a value is updated. Is this a bug or intended behavior?

16 Nov 2012, 9:17 PM
#2
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,865
Plugin Contributions:
3

Re: [Not a bug] Configuration 'use_function' called for display instead of update

Hi,

It is the wiki information that is incorrect. The use_function is used to transform a configuration value before displaying it.

e.g. the configuration value may be a country id, this needs to be transformed to a countries name before displaying.

I have updated the wiki to reflect this.

16 Nov 2012, 10:15 PM
#3
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: [Not a bug] Configuration 'use_function' called for display instead of update

Thank You for the clarification :smile: