public function ImageToolkitManager::getDefaultToolkitId

public ImageToolkitManager::getDefaultToolkitId()

Gets the default image toolkit ID.

Return value

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

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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!ImageToolkit!ImageToolkitManager.php/function/ImageToolkitManager::getDefaultToolkitId/8.1.x