function ImageToolkitManager::getDefaultToolkitId

Same name in other branches
  1. 9 core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php \Drupal\Core\ImageToolkit\ImageToolkitManager::getDefaultToolkitId()
  2. 10 core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php \Drupal\Core\ImageToolkit\ImageToolkitManager::getDefaultToolkitId()
  3. 11.x core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php \Drupal\Core\ImageToolkit\ImageToolkitManager::getDefaultToolkitId()

Gets the default image toolkit ID.

Return value

string|bool ID of the default toolkit, or FALSE on error.

1 call to ImageToolkitManager::getDefaultToolkitId()
ImageToolkitManager::getDefaultToolkit in core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php
Gets the default image toolkit.

File

core/lib/Drupal/Core/ImageToolkit/ImageToolkitManager.php, line 53

Class

ImageToolkitManager
Manages image toolkit plugins.

Namespace

Drupal\Core\ImageToolkit

Code

public function getDefaultToolkitId() {
    $toolkit_id = $this->configFactory
        ->get('system.image')
        ->get('toolkit');
    $toolkits = $this->getAvailableToolkits();
    if (!isset($toolkits[$toolkit_id]) || !class_exists($toolkits[$toolkit_id]['class'])) {
        // The selected toolkit isn't available so return the first one found. If
        // none are available this will return FALSE.
        reset($toolkits);
        $toolkit_id = key($toolkits);
    }
    return $toolkit_id;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.