You are here

public static function ThrobberManager::isValidThrobber in Ajax loader 7

Validates throbber object.

Parameters

$class_name:

Return value

bool

3 calls to ThrobberManager::isValidThrobber()
AjaxLoaderTestCase::testManager in ./ajax_loader.test
Test manager.
ajax_loader_page_build in ./ajax_loader.module
Implements hook_page_build().
ThrobberManager::processUserDefinedThrobbers in lib/ThrobberManager.php
Returns all valid throbbers definied by other modules through hook_ajax_throbber().

File

lib/ThrobberManager.php, line 38
Class ThrobberManager

Class

ThrobberManager
@file Class ThrobberManager

Code

public static function isValidThrobber($class_name) {
  $throbber = FALSE;
  if (class_exists($class_name)) {
    $throbber = new $class_name();
  }
  if (!$throbber instanceof ThrobberInterface) {

    // throbber has to be instance of ThrobberInterface.
    $throbber = FALSE;
  }
  elseif (empty($throbber
    ->getLabel()) || empty($throbber
    ->getCssFile()) || empty($throbber
    ->getMarkup())) {

    // Properties have to be filled out.
    $throbber = FALSE;
  }
  return $throbber;
}