class NodeHelper in Node expire 7.2
NodeHelper class.
Hierarchy
- class \Drupal\node_expire\Module\CommonExpire\Node\NodeHelper
Expanded class hierarchy of NodeHelper
1 file declares its use of NodeHelper
- ActionsHandler.php in src/
Module/ CommonExpire/ Actions/ ActionsHandler.php - ActionsHandler class.
File
- src/
Module/ CommonExpire/ Node/ NodeHelper.php, line 13 - NodeHelper class.
Namespace
Drupal\node_expire\Module\CommonExpire\NodeView source
class NodeHelper {
/**
* Publishes node by $nid.
*/
public static function publishNode($nid) {
// Load the node object.
$node = node_load($nid);
// Set status property to 1.
$node->status = 1;
// Save the node.
node_save($node);
}
/**
* Unpublishes node by $nid.
*/
public static function unpublishNode($nid) {
// Load the node object.
$node = node_load($nid);
// Set status property to 0.
$node->status = 0;
// Save the node.
node_save($node);
}
/**
* Makes node sticky by $nid.
*/
public static function makeNodeSticky($nid) {
// Load the node object.
$node = node_load($nid);
// Set sticky property to 1.
$node->sticky = 1;
// Save the node.
node_save($node);
}
/**
* Makes node unsticky by $nid.
*/
public static function makeNodeUnsticky($nid) {
// Load the node object.
$node = node_load($nid);
// Set sticky property to 0.
$node->sticky = 0;
// Save the node.
node_save($node);
}
/**
* Promotes node to front page by $nid.
*/
public static function promoteNode($nid) {
// Load the node object.
$node = node_load($nid);
// Set promote property to 1.
$node->promote = 1;
// Save the node.
node_save($node);
}
/**
* Removes node from front page by $nid.
*/
public static function unpromoteNode($nid) {
// Load the node object.
$node = node_load($nid);
// Set promote property to 0.
$node->promote = 0;
// Save the node.
node_save($node);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NodeHelper:: |
public static | function | Makes node sticky by $nid. | |
NodeHelper:: |
public static | function | Makes node unsticky by $nid. | |
NodeHelper:: |
public static | function | Promotes node to front page by $nid. | |
NodeHelper:: |
public static | function | Publishes node by $nid. | |
NodeHelper:: |
public static | function | Removes node from front page by $nid. | |
NodeHelper:: |
public static | function | Unpublishes node by $nid. |