-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathexample.php
34 lines (27 loc) · 877 Bytes
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
$node = node_load(1113);
$comment = new stdClass();
$comment->type = 'default';
$comment->ckeditor_comment_body[LANGUAGE_NONE][0]['value'] = 'prog body';
$comment->entity_id = $node->nid;
$comment->entity_vid = $node->vid;
$comment->entity_type = 'node';
$comment->entity_bundle = $node->type;
$comment->field_name = 'body';
$comment->field_summary = 0;
$comment->uid = 1;
$comment->resolved = 1;
$comment->pid = 100;
$comment->created = REQUEST_TIME;
$comment->changed = REQUEST_TIME;
// Create.
ckeditor_comment_save($comment);
// Includes the correct id.
print_r($comment);
$comment->ckeditor_comment_body[LANGUAGE_NONE][0]['value'] = 'changed body';
// Update.
ckeditor_comment_save($comment);
$comment2 = ckeditor_comment_load($comment->cid);
print_r($comment2->ckeditor_comment_body[LANGUAGE_NONE][0]['value']);
// Delete.
ckeditor_comment_delete($comment);