Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rmccue committed Apr 1, 2019
0 parents commit 367ee34
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
22 changes: 22 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "humanmade/dev-tools",
"description": "Human Made Platform Developer Tools Module",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Human Made",
"email": "hello@humanmade.com"
}
],
"autoload": {
"files": [
"load.php"
],
"classmap": [
"inc/"
]
},
"require": {
"johnbillion/query-monitor": "~3.3"
}
}
24 changes: 24 additions & 0 deletions inc/namespace.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace HM\Platform\Dev_Tools;

use const HM\Platform\ROOT_DIR;
use function HM\Platform\get_config;

/**
* Bootstrap.
*/
function bootstrap() {
add_action( 'plugins_loaded', __NAMESPACE__ . '\\on_plugins_loaded', 1 );
}

/**
* Load in other code as necessary.
*/
function on_plugins_loaded() {
$config = get_config()['modules']['dev-tools'];

if ( $config['query-monitor'] ) {
require_once ROOT_DIR . '/vendor/johnbillion/query-monitor/query-monitor.php';
}
}
23 changes: 23 additions & 0 deletions load.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace HM\Platform\Dev_Tools;

use HM\Platform;
use function HM\Platform\get_environment_architecture;

require_once __DIR__ . '/inc/namespace.php';

add_action( 'hm-platform.modules.init', function () {
$default_settings = [
'enabled' => in_array( get_environment_architecture(), [ 'local-server' ] ),
'query-monitor' => true,
];

Platform\register_module(
'dev-tools',
__DIR__,
'Developer Tools',
$default_settings,
__NAMESPACE__ . '\\bootstrap'
);
} );

0 comments on commit 367ee34

Please sign in to comment.