function announcements_enable
Search API
7.x announcements.install | announcements_enable() |
6.x announcements.install | announcements_enable() |
File
- modules/
announcements/ announcements.install, line 48
Code
function announcements_enable() {
// Now, add a piece of custom content using content_save() function.
$content = new stdClass();
$content->type = 'announcement';
$content->cid = "new";
$content->published = 1;
$content->delete_flag = 0;
$content->title = "Sample Announcement";
// TODO: This extra field data (aside from title) is not getting saved on first install, because hooks do not appear to be working
// on first install of FlightPath. At least, not in this situation. I think it's because the content_content_save function cannot find
// all the fields associated with this content type.
$content->field__activity_datetime ['value'] = date("Y-m-d H:ia");
$content->field__msg ['value'] = '<p>This is a sample announcement! You may add new announcements (or delete this one) from the Admin Tools, then Content.</p>';
$content->field__visibility ['value'] = 'public';
content_content_save($content); // Since this is in our install script (which is run on first installation of FlightPath, we will call content_content_save, instead
// of just content_save, thereby skipping the hook check.
}