| 1 |
Developer notes
Possible future plans
Oh all right random, incomprehensible ramblings and snippets
This set of questions has been there since day 1 of my code:
// easiest thing to do is to keep a fake term data ready? then we could just do this:
// $result = db_query(db_rewrite_sql('SELECT t.tid, t.* FROM {cmt_term_data} t INNER JOIN {cmt_term_hierarchy} h ON h.parent = t.tid WHERE h.tid = %d ORDER BY weight, name', 't', 'tid'), $tid);
// can db_rewrite_sql possibly be useful in my context? No. Can I re-enact what it does?
// how do I know what other modules are trying to do with db_rewrite_sql?
// could I compare the results of my calculation of thresholds with the selection of exposed terms returned by a db_rewrite_sql'ed query?
Still need feedback on it...
/*
// unfortunately, you can't just change the type to markup. To get ANYTHING to display you have to put it all in '#value' and do all HTML formatting yourself. That would have been so cool to make forms display-only with a flag.
$form['description'] = array('#type' => 'markup',
'#title' => t('Description'),
'#default_value' => $edit['description'],
);
$form['nodes'] = array('#type' => 'markup', // was checkboxes
'#title' => t('Types'),
'#default_value' => $edit['nodes'],
'#options' => node_get_types('names'),
'#description' => t('A list of node types you want to associate with this vocabulary.'),
'#required' => TRUE,
);
$form['hierarchy'] = array('#type' => 'markup', // was radios
'#title' => t('Hierarchy'),
'#default_value' => $edit['hierarchy'],
'#options' => array(t('Disabled'), t('Single'), t('Multiple')),
'#description' => t('Allows <a href="@help-url">a tree-like hierarchy</a> between terms of this vocabulary.', array('@help-url' => url('admin/help/taxonomy', NULL, NULL, 'hierarchy'))),
);
*/
had this in the recursive function, the set_message, to see what was going on
while ($obj = db_fetch_object($result))
{
$kids[] = $obj->kid;
drupal_set_message(' k: ' . $obj->kid);
}
in nodeapi
/*
$parents = taxonomy_get_parents(20);
$output = "";
$v = 5;
for($i=0;$i<$v;$i++, $output .= ", ") {
$output .= $i;
if($i==4) $v = 10;
}
// "<pre>" . print_r($parents, TRUE) . "</pre>";
*/
// debugging cmt_node_get_terms
/*
print '<pre>';
print_r($cmt_terms[$nid]);
print '</pre>';
*/
Um, no. KISS.
$output .= drupal_get_form('cmt_terms_node_form', array('content_id' => $content_id, 'operation' => $operation));
Removed from cmt_term_hierarchy_form (based on community_tags)
'#access' => $access,
// established that Drupal will throw the error and stick the term back in, even though the function that creates the form has no input-- so for those purposes, this isn't necessary
'#default_value' => $edit['term'],
// well, it IS required but only for this form, which is one of several on the page
'#required' => TRUE,
Shouldn't be an issue, especially with JavaScript, but if someone fills in multiple textfields and expects it all to be entered when they press submit anywhere, they will be disappointed.
Not going this route yet:
/**
* Populate $edit for
*
* @param
*/
function _cmt_term_hierarchy_ {
}
This is no longer accurate because
* Return an array of all vocabulary objects associated with CMT or other specified module.
* It might be a good idea to see if this could be merged with taxonomy_get_vocabularies
*
SQL here is still worth comparing
/* maybe better:
$result = db_query(db_rewrite_sql("SELECT v.vid, v.*, n.type FROM {cmt_vocabulary} cv LEFT JOIN {vocabulary} v ON v.vid = cv.vid LEFT JOIN {vocabulary_node_types} n ON v.vid = n.vid ORDER BY v.weight, v.name", 'v', 'vid'));
*/
// I'm worried about my replacing image_gallery and forum with cmt in the module field
// but initial tests of both modules had no problem with it
but we didn't do
from cmt_term_vocab_set
// being able to vote on what vocabulary a term goes in would be a little more than uncommenting these lines
// for one thing the cmt_term_vocab table needs a content_id column
// it would probably be easier to implement than use!
// $content_type = 'cmt_term_vocab';
// cmt_vote($content_type, $content_id, $uid = NULL, $value = 1);
Actually, with the new setup it would be rolled into cmt_term_attribute_set and be much better for it too!
huh...
cmt_new_term_node_save($form_values['nid'], array('tags' => array($form_values['vid'] => $form_values['tags'])), TRUE, $user->uid);
* NOTE TO SELF: Am I over-displaying term foms? @TODO: check this.
done. I was and it's fixed now.
|