You are here

class ActionsHandler in Node expire 7.2

ActionsHandler class.

Hierarchy

Expanded class hierarchy of ActionsHandler

1 file declares its use of ActionsHandler
CommonHookHandler.php in src/Module/Hook/CommonHookHandler.php
CommonHookHandler class.

File

src/Module/CommonExpire/Actions/ActionsHandler.php, line 16
ActionsHandler class.

Namespace

Drupal\node_expire\Module\CommonExpire\Actions
View source
class ActionsHandler {

  /**
   * Executes particular action with the node..
   */
  public static function doAction($action_type, $nid) {
    switch ($action_type) {
      case ActionTypeEnum::NONE:

        // Do nothing.
        break;
      case ActionTypeEnum::RULES_EVENT:
        if (module_exists('rules')) {
          $node = node_load($nid);
          rules_invoke_event('node_expired', $node);
        }
        else {
          throw new ExpireException(t('Module Rules is not installed.'));
        }
        break;
      case ActionTypeEnum::NODE_PUBLISH:
        NodeHelper::publishNode($nid);
        break;
      case ActionTypeEnum::NODE_UNPUBLISH:
        NodeHelper::unpublishNode($nid);
        break;
      case ActionTypeEnum::NODE_STICKY:
        NodeHelper::makeNodeSticky($nid);
        break;
      case ActionTypeEnum::NODE_UNSTICKY:
        NodeHelper::makeNodeUnsticky($nid);
        break;
      case ActionTypeEnum::NODE_PROMOTE_TO_FRONT:
        NodeHelper::promoteNode($nid);
        break;
      case ActionTypeEnum::NODE_REMOVE_FROM_FRONT:
        NodeHelper::unpromoteNode($nid);
        break;
      default:

        // Do nothing.
        break;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ActionsHandler::doAction public static function Executes particular action with the node..