Example #1
0
 /**
  * Gets the HTML to insert the assets of the given type and groupName.
  *
  * @param string $type      Type of asset to fetch
  * @param string $groupName Optional groupName name to fetch
  *
  * @return string
  *
  * @since 2.0
  */
 public function get($type, $groupName = null)
 {
     $group = $this->getGroup($type, $groupName);
     $typeInstance = $this->getType($type);
     // TODO: move file path fetching into filers so pre-processing can happen
     $tags = '';
     foreach ($group->getFiles() as $file) {
         // Get the path of the file
         $filePath = $this->finder->find($type . '/' . $file);
         // Copy that to our output directory if needed
         $outputDir = $this->docroot . '/' . $type;
         if (!is_dir($outputDir)) {
             mkdir($outputDir, 0777, true);
         }
         copy($filePath, $outputDir . '/' . $file);
         // Build the html tag
         $tags .= $typeInstance->wrapFile("//{$this->baseURL}/{$type}/{$file}");
     }
     return $tags;
 }