Skip to content

Instantly share code, notes, and snippets.

@beaverbuilder
Last active November 1, 2018 22:47
Show Gist options
  • Save beaverbuilder/8d6f500179673c841fc453d4a3a2f18d to your computer and use it in GitHub Desktop.
Save beaverbuilder/8d6f500179673c841fc453d4a3a2f18d to your computer and use it in GitHub Desktop.
<?php
class FLExampleModule extends FLBuilderModule {
public function __construct() {
parent::__construct( array(
'name' => 'Example',
) );
}
public function filter_settings( $settings ) {
/**
* Convert an old setting to a new setting.
* Don't forget to unset the old setting!
*/
if ( isset( $settings->old_setting ) ) {
$settings->new_setting = do_something_with_old_setting( $settings->old_setting );
unset( $settings->old_setting );
}
/**
* Change an existing setting.
*/
if ( isset( $settings->existing_setting ) ) {
$settings->existing_setting = do_something( $settings->existing_setting );
}
/**
* Always return the settings when you are done.
*/
return $settings;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment