Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Suggestion: Don't render empty module console information #4299

Closed
wants to merge 2 commits into from

2 participants

@tux-rampage

This change will allow modules to provide the console usage and banner
information dynamically and returning an empty array/string when nothing
should be rendered.

A module can now check the environment and capabilities before returning
the information.

tux-rampage added some commits
@tux-rampage tux-rampage Hotfix: Don't render empty console information
This change will allow modules to provide the console usage and banner
information dynamically and returning an empty array/string when nothing
should be rendered. 

A module can now check the environment and capabilities before returning
the information.
9d306a3
@tux-rampage tux-rampage Don't render empty console banners
This change will allow modules to provide the console banner
information dynamically and returning an empty string when nothing
should be rendered. 

A module can now check the environment and capabilities before returning
the information.

This was missing in the last commit
9799ad6
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/4299' into develop
Forward port #4299
dc3b162
@ghost Unknown referenced this pull request from a commit
@weierophinney weierophinney Merge branch 'hotfix/4299'
Close #4299
249dfe9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 23, 2013
  1. @tux-rampage

    Hotfix: Don't render empty console information

    tux-rampage authored
    This change will allow modules to provide the console usage and banner
    information dynamically and returning an empty array/string when nothing
    should be rendered. 
    
    A module can now check the environment and capabilities before returning
    the information.
  2. @tux-rampage

    Don't render empty console banners

    tux-rampage authored
    This change will allow modules to provide the console banner
    information dynamically and returning an empty string when nothing
    should be rendered. 
    
    A module can now check the environment and capabilities before returning
    the information.
    
    This was missing in the last commit
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 3 deletions.
  1. +9 −3 library/Zend/Mvc/View/Console/RouteNotFoundStrategy.php
View
12 library/Zend/Mvc/View/Console/RouteNotFoundStrategy.php
@@ -221,8 +221,14 @@ protected function getConsoleBanner(ConsoleAdapter $console, ModuleManagerInterf
continue; // this module does not provide a banner
}
+ // Don't render empty completely empty lines
+ $banner = $module->getConsoleBanner($console);
+ if ($banner == '') {
+ continue;
+ }
+
// We colorize each banners in blue for visual emphasis
- $banners[] = $console->colorize($module->getConsoleBanner($console), ColorInterface::BLUE);
+ $banners[] = $console->colorize($banner, ColorInterface::BLUE);
}
}
@@ -281,10 +287,10 @@ protected function getConsoleUsage(
$usage = $module->getConsoleUsage($console);
// Normalize what we got from the module or discard
- if (is_array($usage)) {
+ if (is_array($usage) && !empty($usage)) {
array_unshift($usage, $moduleName);
$usageInfo[$name] = $usage;
- } elseif (is_string($usage)) {
+ } elseif (is_string($usage) && ($usage != '')) {
$usageInfo[$name] = array($moduleName, $usage);
}
}
Something went wrong with that request. Please try again.