I need a better hobby
Blog Written with a loving hand by kitt some time around 20:42 on 23 November 2014#glare
Blog Written with a loving hand by kitt some time around 17:29 on 16 November 2014$ grep -r notifications_subscription_list_form contrib contrib/notifications/notifications.module: $form['#submit'][] = 'notifications_subscription_list_form_validate'; contrib/notifications/notifications.module: $form['#validate'][] = 'notifications_subscription_list_form_submit'; $
Submit as validate and validate as submit. This is going to be interesting as I dig into the code.
Git checkout local repo from N days ago
Blog Yeah, kitt finished writing this at 12:03 on 10 November 2014git checkout @{two.days.ago}
If only there were a way to checkout files from the fuyoocha.
git checkout @{two.days.fromnow}
or maybe
git checkout @{two.days.aftercompleting}
Drupal 7 - get all terms for a node
Blog Posted by kitt at 19:19 on 9 November 2014Okay, you can use api.drupal.org/field_view_field, if you know all the various fields a node is using for terms and term references (reference):
$terms = field_view_field('node', $node, 'field_tags');If you don't, load them all in one fell swoop (with lots of caching, please):
/** * Likely in hook_preprocess_node. */ function mymodule_preprocess_node(&$vars) { $multi = array(); // get all the terms for this node, add status if desired $results = db_query('SELECT tid FROM {taxonomy_index} WHERE nid = :nid', array(':nid' => $vars['node']->nid)); // loop over the terms for the tids foreach ($results as $result) { $tids[] = $result->tid; } // load all the terms at once if (count($tids) > 0) { $terms = taxonomy_term_load_multiple($tids); // and do shit with them. foreach ($terms as $tid => $term) { // in this particular case, push them onto an array to track in google analytics. $multi[] = array('_trackEvent', 'terms', $term->vocabulary_machine_name, $term->name); } } drupal_add_js(array('multi' => $multi), 'setting'); }