getType() public method

Return the asset type.
public getType ( ) : string
return string
Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * Register the asset.
  *
  * @param Asset $asset
  * @return void
  */
 protected function register(Asset $asset)
 {
     if ($asset->getType() === 'script') {
         $this->registerScript($asset);
     } else {
         $this->registerStyle($asset);
     }
 }
Ejemplo n.º 3
0
 /**
  * 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']);
         }
     }
 }