getType() public method

Return the asset type.
public getType ( ) : string
return string
コード例 #1
0
ファイル: Asset.php プロジェクト: johnulist/framework
 /**
  * Register the asset.
  *
  * @param Asset $asset
  * @return void
  */
 protected function register(Asset $asset)
 {
     // Avoid duplicate calls to each instance.
     if ($this->getArea() !== $asset->getArea()) {
         return;
     }
     if ($asset->getType() === 'script') {
         $this->registerScript($asset);
     } else {
         $this->registerStyle($asset);
     }
     // Add asset to list of called instances.
     static::$instantiated[$this->getArea()][$this->getKey()] = $this;
 }
コード例 #2
0
ファイル: Asset.php プロジェクト: Tisseur2Toile/framework
 /**
  * Register the asset.
  *
  * @param Asset $asset
  * @return void
  */
 protected function register(Asset $asset)
 {
     if ($asset->getType() === 'script') {
         $this->registerScript($asset);
     } else {
         $this->registerStyle($asset);
     }
 }
コード例 #3
0
ファイル: Asset.php プロジェクト: themosis/framework
 /**
  * Register inline code.
  *
  * @param Asset $asset
  */
 protected function registerInline(Asset $asset)
 {
     $args = $asset->getArgs();
     if (empty($args) || !isset($args['inline'])) {
         return;
     }
     // Process if there are inline codes.
     $inlines = $args['inline'];
     foreach ($inlines as $inline) {
         if ('script' === $asset->getType()) {
             wp_add_inline_script($args['handle'], $inline['data'], $inline['position']);
         } elseif ('style' === $asset->getType()) {
             wp_add_inline_style($args['handle'], $inline['data']);
         }
     }
 }