Add hook_oci_menu to allow other classes to add new items to the OCI menu

This commit is contained in:
Kienan Stewart 2018-02-17 09:34:29 -05:00
parent f9c2a60113
commit fcdd844de4
1 changed files with 18 additions and 10 deletions

View File

@ -21,7 +21,7 @@
class m_oci { class m_oci {
function hook_menu() { function hook_menu() {
global $hooks, $L_ALTERNC_WPCLI_BIN, $L_ALTERNC_DRUSH_BIN; global $hooks;
$menu = array( $menu = array(
'title' => _('Quick Install'), 'title' => _('Quick Install'),
'ico' => 'images/ocilogo.png', 'ico' => 'images/ocilogo.png',
@ -29,27 +29,35 @@ class m_oci {
'pos' => 11, 'pos' => 11,
'links' => array(), 'links' => array(),
); );
// @TODO invoke a hook to get supported applications $links = $hooks->invokve('hook_oci_menu');
// need: id (eg. wordpress), weight (to order), ico, and if ($links) {
// optionally - a different action path. $menu['links'] = $links;
// @TODO required binaries for installation: eg, wp-cli, drush }
if ($menu['links']) {
return $menu;
}
}
/**
* Implements hook_oci_menu().
*/
function hook_oci_menu() {
$links = array();
if ($this->app_is_installable('wordpress')) { if ($this->app_is_installable('wordpress')) {
$menu['links'][] = array( $links[] = array(
'txt' => _('WordPress'), 'txt' => _('WordPress'),
'url' => 'oci_install.php?app=wordpress', 'url' => 'oci_install.php?app=wordpress',
'ico' => 'images/wordpress.png', 'ico' => 'images/wordpress.png',
); );
} }
if ($this->app_is_installable('drupal')) { if ($this->app_is_installable('drupal')) {
$menu['links'][] = array( $links[] = array(
'txt' => _('Drupal'), 'txt' => _('Drupal'),
'url' => 'oci_install.php?app=drupal', 'url' => 'oci_install.php?app=drupal',
'ico' => 'images/drupal.png', 'ico' => 'images/drupal.png',
); );
} }
if ($menu['links']) { return $links;
return $menu;
}
} }
/** /**