comment_notify.migrate.inc in Comment Notify 7
Migration support for the Comment Notify module.
File
comment_notify.migrate.inc
View source
<?php
class CommentNotifyMigrationHandler extends MigrateDestinationHandler {
public function __construct() {
$this
->registerTypes(array(
'comment',
));
}
public function fields() {
return array(
'notify' => t('Comment Notify: Whether to send notifications for this comment'),
'notified' => t('Comment Notify: Whether notifications have been sent for this comment'),
'notify_hash' => t('Comment Notify: Hash representing this notification'),
);
}
public function prepare($comment, $row) {
if (!isset($comment->notify)) {
$comment->notify = 0;
}
if (!isset($comment->notify_type)) {
$comment->notify_type = 1;
}
}
public function complete($comment, $row) {
if (!isset($comment->notified) || $comment->notified) {
comment_notify_mark_comment_as_notified($comment);
}
}
}
function comment_notify_migrate_api() {
$api = array(
'api' => 2,
);
return $api;
}