You are here

class ConfigHandler in Node expire 7.2

ConfigHandler class.

Hierarchy

Expanded class hierarchy of ConfigHandler

6 files declare their use of ConfigHandler
AdminHookHandler.php in src/Module/Hook/AdminHookHandler.php
AdminHookHandler class.
CommonHookHandler.php in src/Module/Hook/CommonHookHandler.php
CommonHookHandler class.
FormHookHandler.php in src/Module/Hook/FormHookHandler.php
FormHookHandler class.
FormHookHelper.php in src/Module/Hook/FormHookHelper.php
FormHookHelper class.
NodeHookHandler.php in src/Module/Hook/NodeHookHandler.php
NodeHookHandler class.

... See full list

File

src/Module/Config/ConfigHandler.php, line 13
ConfigHandler class.

Namespace

Drupal\node_expire\Module\Config
View source
class ConfigHandler {

  /**
   * Returns HandleContentExpiry configuration value.
   */
  public static function getHandleContentExpiry() {
    $val = variable_get('node_expire_handle_content_expiry', 2);
    return $val;
  }

  /**
   * Returns TRUE for node types that have the Node expire feature enabled.
   */
  public static function isExpirable($node_type) {
    $ntypes = variable_get('node_expire_ntypes', array());
    if (!isset($ntypes[$node_type])) {
      return FALSE;
    }

    // TODO: WARNING | Unused variable $ntype.
    if (!($ntype = $ntypes[$node_type])) {
      return FALSE;
    }
    return TRUE;
  }

  /**
   * Gets condition for date entry elements.
   *
   * This depends on value of variable node_expire_date_entry_elements
   * and also is date_popup module of date module installed or not.
   *
   * @return int
   *   0 - use text fields
   *   1 - use date popups
   */
  public static function getDateEntryElements() {

    // No date_popup module.
    if (!module_exists('date_popup')) {
      return 0;
    }

    // Legacy mode.
    if (variable_get('node_expire_handle_content_expiry', 2) == 0) {
      return 0;
    }
    return variable_get('node_expire_date_entry_elements', 0);
  }

  /**
   * Returns PastDateAllowed configuration value.
   */
  public static function getPastDateAllowed() {
    $val = variable_get('node_expire_past_date_allowed', 0);
    return $val;
  }

  /**
   * Returns DateFormat configuration value.
   */
  public static function getDateFormat() {
    $val = variable_get('node_expire_date_format', 'Y-m-d');
    return $val;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigHandler::getDateEntryElements public static function Gets condition for date entry elements.
ConfigHandler::getDateFormat public static function Returns DateFormat configuration value.
ConfigHandler::getHandleContentExpiry public static function Returns HandleContentExpiry configuration value.
ConfigHandler::getPastDateAllowed public static function Returns PastDateAllowed configuration value.
ConfigHandler::isExpirable public static function Returns TRUE for node types that have the Node expire feature enabled.