mysite_get_custom($type, $type_id = NULL, $all = FALSE)
mysite.module, line 3073
Get the data for a custom content type from the {mysite_content} table.
$type The type of mysite content being created. Required.
$type_id The mysite content id of the item to retrieve. Required.
$all A boolean flag indicating whether to return data for all custom items or a specific item.
An object containing the data from the {mysite_content} table. In the case of individual content items, a content_raw element is added in order to enable droplet editing. Note that content_raw should never be exposed to end users.
function mysite_get_custom($type, $type_id = NULL, $all = FALSE) {
$sql = "SELECT myid, type, type_key, title, content, format, base, xml FROM {mysite_content} WHERE myid = %d AND type = '%s'";
if ($all) {
$i = 0;
$sql = "SELECT myid, type, type_key, title, content, format, base, xml FROM {mysite_content} WHERE type = '%s'";
$result = db_query($sql, $type);
while ($return = db_fetch_object($result)) {
$data[$i] = $return;
$data[$i]->title = $return->title;
$data[$i]->content = unserialize($data[$i]->content);
if ($data[$i]->format > 0) {
$data[$i]->content = check_markup($data[$i]->content, $data[$i]->format, FALSE);
}
$i++;
}
}
else {
$data = db_fetch_object(db_query($sql, $type_id, $type));
$data->content = unserialize($data->content);
$data->content_raw = $data->content; // in the edit case, this needs to be unfiltered
if ($data->format > 0) {
$data->content = check_markup($data->content, $data->format, FALSE);
}
}
return $data;
}