Example #1
0
 public function testGetCorrectClassWithCondition()
 {
     $active = new Active(null);
     $this->assertSame('active', $active->getClassIf(true));
     $this->assertSame('selected', $active->getClassIf(true, 'selected'));
     $this->assertSame('not-checked', $active->getClassIf(false, 'selected', 'not-checked'));
 }
Example #2
0
 /**
  * Get the current controller class
  *
  * @return string 
  * @static 
  */
 public static function getController()
 {
     return \HieuLe\Active\Active::getController();
 }
 /**
  * Return 'active' class if the current route name matches a specific value, route parameters with keys defined in
  * the `$params` has the correct value.
  * 
  * The `$params` is an associative array, the key is name of the route parameter, the item is the desired value of
  * that parameter.
  *
  * @param string $routeName
  * @param array $params
  * @param string $activeClass
  * @param string $inactiveClass
  * @return string 
  * @since 2.3.0
  * @static 
  */
 public static function routeParam($routeName, $params, $activeClass = 'active', $inactiveClass = '')
 {
     return \HieuLe\Active\Active::routeParam($routeName, $params, $activeClass, $inactiveClass);
 }