Example #1
0
 public static function tabsFactory($config, $args)
 {
     $tag = Tag::create($config['tagName']);
     foreach ($config['attributes'] as $name => $value) {
         $tag->{$name}($value);
     }
     foreach ($args as $index => $arg) {
         $options = array();
         $link_to = '#';
         $text = 'Menu' . $index;
         if (!is_array($arg)) {
             $text = $arg;
         } else {
             if ($arg[0]) {
                 $text = $arg[0];
             }
             if ($arg[1]) {
                 $link_to = $arg[1];
             }
             if ($arg[2]) {
                 $options['class'] = 'active';
             }
         }
         $tag->append(Tag::li($options, Tag::a(array('href' => $link_to), $text)));
     }
     return $tag;
 }
Example #2
0
 public static function alertFactory(array $config, array $args = array())
 {
     $tag = Tag::create($config['tagName']);
     foreach ($config['attributes'] as $name => $value) {
         $tag->{$name}($value);
     }
     $func = function ($args) use(&$func, $tag) {
         if (is_array($args)) {
             foreach ($args as $arg) {
                 call_user_func($func, $arg);
             }
         } else {
             $tag->append(Tag::p($args));
         }
     };
     call_user_func($func, $args);
     return $tag;
 }