You are here

function skinr_get_skin_info in Skinr 8.2

Same name and namespace in other branches
  1. 7.2 skinr.module \skinr_get_skin_info()

Retrieves all skins registered by modules and themes.

Return value

An array of skins.

12 calls to skinr_get_skin_info()
LibraryListForm::buildForm in skinr_ui/src/Form/LibraryListForm.php
Form constructor.
LibraryListForm::submitForm in skinr_ui/src/Form/LibraryListForm.php
Form submission handler.
Skin::skinLabel in src/Entity/Skin.php
Returns the theme label.
SkinEditForm::form in skinr_ui/src/Form/SkinEditForm.php
Gets the actual form array to be built.
SkinrApiTest::testSkinrSkinInfo in src/Tests/SkinrApiTest.php
Tests hook_skinr_skin_info().

... See full list

File

./skinr.module, line 1162
Handles core Skinr functionality.

Code

function skinr_get_skin_info() {
  $skin_info =& drupal_static(__FUNCTION__);
  if ($skin_info === NULL) {
    if ($cached = \Drupal::cache()
      ->get('skinr_skin_info')) {
      $skin_info = $cached->data;
      return $skin_info;
    }
    $skin_info = [];
    $plugins = \Drupal::service('plugin.manager.skin')
      ->getDefinitions();
    foreach ($plugins as $plugin) {
      if (empty($plugin['skins'])) {
        continue;
      }
      $skin_info = $plugin['skins'];
    }

    // Allow modules to alter registered skin information.
    \Drupal::moduleHandler()
      ->alter('skinr_skin_info', $skin_info);
    \Drupal::cache()
      ->set('skinr_skin_info', $skin_info);
  }
  return $skin_info;
}