Exemple #1
0
 /**
  * Gets a full URL to the directory containing all of a block's items, including JavaScript, tools, icons, etc...
  *
  * @param \Concrete\Core\Entity\Block\BlockType\BlockType $bt
  * @param bool|string $file If provided will get the assets url for a file in a block
  *
  * @return string $url
  */
 public function getBlockTypeAssetsURL($bt, $file = false)
 {
     $ff = '';
     if ($file != false) {
         $ff = '/' . $file;
     }
     $url = '';
     if (file_exists(DIR_FILES_BLOCK_TYPES . '/' . $bt->getBlockTypeHandle() . $ff)) {
         $url = REL_DIR_APPLICATION . '/' . DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . $ff;
     } elseif ($bt->getPackageID() > 0) {
         $h = $bt->getPackageHandle();
         $dirp = is_dir(DIR_PACKAGES . '/' . $h) ? DIR_PACKAGES . '/' . $h : DIR_PACKAGES_CORE . '/' . $h;
         if (file_exists($dirp . '/' . DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . $ff)) {
             $url = is_dir(DIR_PACKAGES . '/' . $h) ? DIR_REL : ASSETS_URL;
             $url = $url . '/' . DIRNAME_PACKAGES . '/' . $h . '/' . DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . $ff;
         }
     } elseif (file_exists(DIR_FILES_BLOCK_TYPES_CORE . '/' . $bt->getBlockTypeHandle() . $ff)) {
         $url = ASSETS_URL . '/' . DIRNAME_BLOCKS . '/' . $bt->getBlockTypeHandle() . $ff;
     }
     return $url;
 }