home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (node.eval.inc)

This example Drupal source code file (node.eval.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

function, in_array, node, php, return, rules_condition_node_is_of_type, rules_condition_node_is_promoted, rules_condition_node_is_published, rules_condition_node_is_sticky, types

The node.eval.inc Drupal example source code

<?php
// $Id: node.eval.inc,v 1.1.2.1 2010/12/16 09:30:43 fago Exp $

/**
 * @file
 * Contains rules integration for the node module needed during evaluation.
 *
 * @addtogroup rules
 * @{
 */

/**
 * Condition: Check for selected content types
 */
function rules_condition_node_is_of_type($node, $types) {
  return in_array($node->type, $types);
}

/**
 * Condition: Check if the node is published
 */
function rules_condition_node_is_published($node) {
  return $node->status == 1;
}

/**
 * Condition: Check if the node is sticky
 */
function rules_condition_node_is_sticky($node) {
  return $node->sticky == 1;
}

/**
 * Condition: Check if the node is promoted to the frontpage
 */
function rules_condition_node_is_promoted($node) {
  return $node->promote == 1;
}

/**
 * @}
 */

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal node.eval.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.