public static function get_all_template_metadata()
 {
     $metadata_array = array();
     $dirs = glob(EZP_CS_Utility::$MINI_THEMES_TEMPLATE_DIRECTORY . "*", GLOB_ONLYDIR);
     sort($dirs);
     foreach ($dirs as $dir) {
         $metadata = null;
         $metadata_path = $dir . "/metadata.json";
         if (file_exists($metadata_path)) {
             $metadata_text = file_get_contents($metadata_path);
             if ($metadata_text != false) {
                 $metadata = json_decode($metadata_text);
             } else {
                 self::debug("No metadata in {$metadata_path}");
             }
         } else {
             self::debug("No metadata file in {$dir}");
         }
         if ($metadata != null) {
             $template_key = basename($dir);
             // RSR TODO: Have a way to give each item a unique key if it conflicts..?
             EZP_CS_Utility::add_property($metadata, 'template_key', $template_key);
             EZP_CS_Utility::add_property($metadata, 'screenshot_url', EZP_CS_Utility::$PLUGIN_URL . "/templates/{$template_key}/screenshot.png");
             array_push($metadata_array, $metadata);
         }
     }
     return $metadata_array;
 }