changed_fields_basic_usage.module in Changed Fields API 7
Same filename and directory in other branches
- 8.3 examples/changed_fields_basic_usage/changed_fields_basic_usage.module
- 8 examples/changed_fields_basic_usage/changed_fields_basic_usage.module
- 8.2 examples/changed_fields_basic_usage/changed_fields_basic_usage.module
- 7.3 examples/changed_fields_basic_usage/changed_fields_basic_usage.module
- 7.2 examples/changed_fields_basic_usage/changed_fields_basic_usage.module
File
examples/changed_fields_basic_usage/changed_fields_basic_usage.moduleView source
<?php
/**
* @file
* changed_fields_basic_usage.module file.
*/
/**
* Implements hook_node_presave().
*/
function changed_fields_basic_usage_node_presave(stdClass $node) {
// Enlist node types with their fields for watching.
$notifySettings = array(
'article' => array(
'title',
'body',
),
);
// Create CFNodeSubject object that will check node fields by CFDefaultFieldComparator.
$nodeSubject = new CFNodeSubject($node, $notifySettings, new CFDefaultFieldComparator());
// Add your observer object to CFNodeSubject.
// See includes/changed_fields_basic_usage.observer.inc file.
$nodeSubject
->addObserver(new BasicUsageObserver('test_observer'));
// Check if node fields have been changed.
$nodeSubject
->checkNodeFields();
}
Functions
Name | Description |
---|---|
changed_fields_basic_usage_node_presave | Implements hook_node_presave(). |