It would be very useful to be able to add a selection rule for the term ID.

Scenario:

  • You have a taxonomy/term panel you would like to use as the default.
  • You would like to override certain term pages, e.g. to highlight a particular term, modify the layout, etc.

Comments

damienmckenna’s picture

Status: Active » Needs work
StatusFileSize
new3.25 KB

Here's a starting point.

damienmckenna’s picture

So, with an initial starting point, any thoughts on how to make this better, more solid so it could be added to CTools?

damienmckenna’s picture

StatusFileSize
new3.25 KB

Updated file:
* Gave it a more useful name - term_tid.
* The summary display says what terms are selected rather than just naming the vocabulary.

merlinofchaos’s picture

You might look at the term context to see how I dealt with the whole "pick a term from multiple vocabularies" while still keeping the UI workable. I don't like the way the settings in this one works.

damienmckenna’s picture

Am digging into the latest CVS to give it another spin..

damienmckenna’s picture

StatusFileSize
new3.94 KB

Here's an updated version. It works, but it needs some error checking.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new4.34 KB

Here's a version of the last file as a proper patch.

damienmckenna’s picture

StatusFileSize
new4.76 KB

Updated patch, forgot to update the ctools_term_ctools_access_check() function.

merlinofchaos’s picture

Status: Needs review » Fixed

Looks reasonable. Committed.

damienmckenna’s picture

Thanks :-)

damienmckenna’s picture

StatusFileSize
new4.4 KB

datacaliber found a bug in the file, here's an updated one.

damienmckenna’s picture

Nevermind, I see you fixed it in CVS. Thanks :)

damienmckenna’s picture

FYI, here's some code to migrate settings from my early patches above to the current code in the 1.1 release:

  // Fix the CTools vocabulary term selector.
  $panels = db_query("SELECT did, conf FROM {page_manager_handlers} WHERE task='term_view'");
  while ($panel = db_fetch_object($panels)) {
    $conf = unserialize($panel->conf);
    $did = $panel->did;
    // print_r($conf['access']['plugins'][0]);
    if ($conf['access']['plugins'][0]['name'] == 'term_tid' || $conf['access']['plugins'][0]['name'] == 'term') {
      $conf['access']['plugins'][0]['name'] = 'term';
      if (isset($conf['access']['plugins'][0]['settings']['vids'])) {
        $vid = array_pop($conf['access']['plugins'][0]['settings']['vids']);
        if (is_array($vid)) {
          $vid = array_pop($vid);
        }
        unset($conf['access']['plugins'][0]['settings']['vids']);
        $conf['access']['plugins'][0]['settings']['vid'] = $vid;
      }
      else {
        $vid = $conf['access']['plugins'][0]['settings']['vid'];
      }
      if (isset($conf['access']['plugins'][0]['settings']['terms'])) {
        $tid = array_pop($conf['access']['plugins'][0]['settings']['terms']);
        unset($conf['access']['plugins'][0]['settings']['terms']);
        $conf['access']['plugins'][0]['settings'][$vid] = array(
          $tid => (string) $tid,
        );
      }
      $panel = serialize($conf);
      // print_r($conf);
      db_query("UPDATE {page_manager_handlers} SET conf='%s' WHERE did=%d", $panel, $did);
    }
  }
  cache_clear_all('*', 'ctools_object_cache', TRUE);

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.