Skip to content

Commit

Permalink
Tweak to make the FW code usable earlier in the line, 2019-07-03
Browse files Browse the repository at this point in the history
  • Loading branch information
ervind committed Jul 3, 2019
1 parent 82cafda commit 9b7097e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -7,6 +7,10 @@ Documentation will be available soon.

## Changelog

### v1.3.4 (2019-07-03)
* Made it possible to run the FW code earlier in the hooks


### v1.3.3 (2019-04-17)

* TinyMCE double button line bugfix
Expand Down
3 changes: 0 additions & 3 deletions framework/data-types/type-number.php
Expand Up @@ -13,9 +13,6 @@ class TPL_Number extends TPL_Data_Type {
// Writes the form field in wp-admin
public function form_field_content ( $args ) {

// var_dump($this);
// var_dump($this->get_option());

if ( $this->get_option() === NULL ) {
$value = $this->default;
}
Expand Down
26 changes: 19 additions & 7 deletions framework/tpl-fw.php
Expand Up @@ -8,19 +8,19 @@


// Version number of the framework
define( 'TPL_VERSION', '1.3.3' );
define( 'TPL_VERSION', '1.3.4' );




// Firstly, adding the necessary action hooks

// Adding admin script...
add_action ( 'admin_enqueue_scripts', 'tpl_admin_scripts', 20 );
// Load data type components
tpl_load_data_types();


// Load data type components
add_action ( 'init', 'tpl_load_data_types' );
// Adding admin script...
add_action ( 'admin_enqueue_scripts', 'tpl_admin_scripts', 20 );


// Initial actions (menus, admin pages)
Expand Down Expand Up @@ -165,6 +165,7 @@ function tpl_load_data_types () {
"type-page_builder",
);


// Now run the load loop for Data Types
foreach ( $files as $file ) {

Expand Down Expand Up @@ -258,11 +259,22 @@ function tpl_remove_empty_p ( $content ) {
OPTION HANDLING
*/


// Registers a setting page
function tpl_add_settings_page( $name, $settings_page_array ) {
global $tpl_settings_pages;

$tpl_settings_pages[$name] = $settings_page_array;

}



// Register an option in the framework
function tpl_register_option ( $narr ) {

// Use the global $tpl_options_array that builds up the Plugin Settings panel
global $tpl_options_array, $tpl_data_types;
global $tpl_options_array;

$narr = apply_filters( 'tpl_before_register_option', $narr );

Expand All @@ -284,7 +296,7 @@ function tpl_register_option ( $narr ) {
// If not registered yet, register it
if ( !$already_registered ) {

if ( !isset( $narr["type"] ) || !in_array( $narr["type"], $tpl_data_types ) ) {
if ( !isset( $narr["type"] ) || !tpl_type_registered( $narr["type"] ) ) {

tpl_error(
sprintf(
Expand Down

0 comments on commit 9b7097e

Please sign in to comment.