Author: weaverryan
Date: 2010-02-06 21:10:48 +0100 (Sat, 06 Feb 2010)
New Revision: 27619
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenu.class.php
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenuSiteManager.class.php
Log:
[1.4][sfSympalPlugin][1.0] Correcting bug where passing in null and false for
the $showChildren variable caused different cache keys to be created for the
same tree.
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenu.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenu.class.php
2010-02-06 17:20:53 UTC (rev 27618)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenu.class.php
2010-02-06 20:10:48 UTC (rev 27619)
@@ -192,12 +192,19 @@
$credentials = $this->getCredentials();
return !empty($credentials);
}
-
+
+ /**
+ * Returns and optionally sets whether or not this menu item should
+ * show its children. If the $bool argument is passed, the _showChildren
+ * property will be set
+ *
+ * @param boolean $bool Whether to show children or not
+ */
public function showChildren($bool = null)
{
- if (!is_null($bool))
+ if ($bool !== null)
{
- $this->_showChildren = $bool;
+ $this->_showChildren = (bool) $bool;
}
return $this->_showChildren;
Modified:
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenuSiteManager.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenuSiteManager.class.php
2010-02-06 17:20:53 UTC (rev 27618)
+++
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalMenuPlugin/lib/menu/sfSympalMenuSiteManager.class.php
2010-02-06 20:10:48 UTC (rev 27619)
@@ -87,7 +87,7 @@
$this->initialize();
}
- public static function getMenu($name, $showChildren = null, $class = null)
+ public static function getMenu($name, $showChildren = false, $class = null)
{
return self::getInstance()->_getMenu($name, $showChildren, $class);
}
@@ -97,7 +97,7 @@
return sfSympalConfig::get('menu_cache', 'enabled', true) ?
sfSympalConfiguration::getActive()->getCache() : false;
}
- protected function _getMenu($name, $showChildren = null, $class = null)
+ protected function _getMenu($name, $showChildren = false, $class = null)
{
if (is_scalar($name) && isset($this->_rootSlugs[$name]))
{
@@ -108,6 +108,8 @@
{
return false;
}
+
+ $showChildren = (bool) $showChildren;
$cacheKey = 'SYMPAL_MENU_'.md5((string) $name.var_export($showChildren,
true).$class);
if (isset($this->_menus[$cacheKey]))
@@ -132,7 +134,7 @@
if ($menu)
{
- if ($showChildren !== null)
+ if ($showChildren)
{
$menu->callRecursively('showChildren', $showChildren);
}
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.