Titan-Framework icon indicating copy to clipboard operation
Titan-Framework copied to clipboard

fire compile option on field change

Open premiumsupport365 opened this issue 11 years ago • 6 comments

Hello , I am not sure if this option is available in titan. I have used redux for sometime and I used compiler in redux to store the values in separate file and included that with the output to perform custom functions.

I wonder if the same type of compiler option available with Titan framework. I saw the demo and impressed by the way titan is presented and made my mind to switch to Titan :+1:

premiumsupport365 avatar Aug 06 '14 12:08 premiumsupport365

What to do you want to compile?

bfintal avatar Aug 06 '14 13:08 bfintal

Please elaborate so we can find out what approach to use to implement it.

oherman avatar Aug 06 '14 14:08 oherman

Hello bfintal and oherman. Thanks for your reply, in redux they have provided an option to run the compiler when the value is changed. which will fire the event and I am using to fetch the values and write to custom file. for example see the lines below

// Function to test the compiler hook and demo CSS output. add_filter('redux/options/'.$this->args['opt_name'].'/compiler', array( $this, 'compiler_action' ), 10, 3);

This is a test function that will let you see when the compiler hook occurs. It only runs if a field set with compiler=>true is changed. function compiler_action($options, $css, $changed_values) { ...................... }

premiumsupport365 avatar Aug 06 '14 14:08 premiumsupport365

So it's for including additional CSS? How about this function: http://www.titanframework.net/generate-css-automatically-for-your-options/

bfintal avatar Aug 06 '14 23:08 bfintal

Hi Mate, its not just CSS. this option actually fires a function when the value of the field is changed and saved. by using that I create css, js even custom functions to be stored in a custom file, as like dynamik gen [genesis child theme] does. Hope this makes sense.

we achieved that through redux using the function I mentioned in my previous comment and it is supplied by default in redux sample config file

premiumsupport365 avatar Aug 07 '14 03:08 premiumsupport365

Ah, okay I get it. This would actually be helpful!

Perhaps a new hook tf_option_changed_{id} or tf_option_changed_type_{type} or tf_options_changed or maybe all of those.

I don't think this can be made applicable to options in meta boxes though

bfintal avatar Aug 07 '14 09:08 bfintal