/** * Get all available containers and widgets * * @return array */ public static function getAvailable() { if (is_null(self::$availableCW)) { $containers = array(); $places = One_Locator::locateAllUsing('*.php', '%ROOT%/form/container/'); $ignore = array('abstract', 'index', 'factory'); foreach ($places as $container) { $container = preg_replace('/_tbd.php$/', '.php', $container); //TODO: replace tmp fix if (preg_match('|([^/]*).php$|', $container, $match)) { if (in_array($match[1], $ignore) || strpos($match[1], '.') !== false) { unset($containers[$container]); } else { $containers[$container] = strtolower($match[1]); } } else { unset($containers[$container]); } } sort($containers); $widgets = array(); $places = One_Locator::locateAllUsing('*.php', '%ROOT%/form/widget/{joomla,multi,scalar,select,search}/'); foreach ($places as $widget) { $widget = preg_replace('/_tbd.php$/', '.php', $widget); //TODO: replace tmp fix if (preg_match('|([^/]*)/([^/]*).php$|', $widget, $match)) { if (!in_array($match[2], $ignore)) { $widgets[] = $match[1] . '-' . strtolower($match[2]); } } } $widgets[] = 'defaultactions'; $widgets[] = 'button'; $widgets[] = 'file'; $widgets[] = 'submit'; $widgets[] = 'label'; $widgets[] = 'button'; $widgets[] = 'nscript'; $widgets[] = 'inline'; //TODO: adding a widget here should not be necessary !! sort($widgets); self::$availableCW = array('containers' => $containers, 'widgets' => $widgets); } return self::$availableCW; }