You are here

public function UltimenuManager::getSkinPath in Ultimenu 8

A reversed process to convert an option into a full CSS skin path.

This silly reversion ensures the setting will be intact when moving around CSS files, or theme and module directory.

Parameters

string $path: The path that should be converted to full CSS path.

Return value

string The CSS path containing ultimenu skins.

Overrides UltimenuManagerInterface::getSkinPath

File

src/UltimenuManager.php, line 589

Class

UltimenuManager
Manages Ultimenu plugin.

Namespace

Drupal\ultimenu

Code

public function getSkinPath($path) {
  if (!isset($this->skinPath)) {
    $this->skinPath = '';
    list(, $skin_name) = array_pad(array_map('trim', explode("|", $path, 2)), 2, NULL);
    if (strpos($path, "module|") !== FALSE) {
      $skin = drupal_get_path('module', 'ultimenu') . '/skins';
      $this->skinPath = $skin . '/' . $skin_name . '.css';
    }
    elseif (strpos($path, "custom|") !== FALSE) {
      $skin = $this
        ->getSetting('skins');
      $this->skinPath = $skin . '/' . $skin_name . '.css';
    }
    elseif (strpos($path, "theme|") !== FALSE) {
      $theme_default = $this
        ->getConfig('system.theme')
        ->get('default');
      $skin = drupal_get_path('theme', $theme_default) . '/css/ultimenu';
      $this->skinPath = $skin . '/' . $skin_name . '.css';
    }
    if ($this->skinPath) {
      $this->skinPath = '/' . $this->skinPath;
    }
  }
  return $this->skinPath;
}