I have exported (via features) the taxonomy/term/%term page variant I created to handle terms in the "Pet types" vocabulary (machine name pet_types). When I enabled this feature on the live site the vocabulary ID didn't match. The export needs to use machine_name instead of vid. See relevant snippet below:

  $handler = new stdClass();
  $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
  $handler->api_version = 1;
  $handler->name = 'term_view_panel_context';
  $handler->task = 'term_view';
  $handler->subtask = '';
  $handler->handler = 'panel_context';
  $handler->weight = -99;
  $handler->conf = array(
    'title' => 'Pet types',
    'no_blocks' => 0,
    'pipeline' => 'standard',
    'body_classes_to_remove' => '',
    'body_classes_to_add' => '',
    'css_id' => '',
    'css' => '',
    'contexts' => array(),
    'relationships' => array(),
    'access' => array(
      'plugins' => array(
        0 => array(
          'name' => 'term_vocabulary',
          'settings' => array(
            'vids' => array(
              13 => '13',
            ),
          ),
          'context' => 'argument_term_1',
          'not' => FALSE,
        ),
      ),
      'logic' => 'and',
    ),
  );
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merlinofchaos’s picture

Oh ugh, we're using vocabulary IDs and not machine names; a failure of the upgrade.

Technically this isn't a bug, I think, but since vocabularies have machine names this really should work this way.

To fix this, we'll have to update the access rule to use machine names instead of vids (and be able to convert vids for existing configs) and automatically fix them when saving the config.

Then when fixed you could re-save the problem handler, export it and it will work.

The workaround until that is done would be to, uh, manually fix your vid on export. Sorry. :/

mstrelan’s picture

Status: Active » Needs work
FileSize
3.94 KB

Here is a start. I've updated the access plugin to use machine names instead of vids. Needs an upgrade script to convert existing variants. Is this used elsewhere and needs updating also?

jwilson3’s picture

Status: Needs work » Needs review
FileSize
3.81 KB

I was actually able to work around my needs for this using the taxonomy term bundle in my selection rules, which does already use the machine name, instead of vid. But, also, I noticed an issue with your patch:

+++ b/plugins/access/term_vocabulary.incundefined
@@ -65,23 +65,22 @@ function ctools_term_vocabulary_ctools_access_check($conf, $context) {
-  return format_plural(count($names), '@identifier vocabulary is "@vids"', '@identifier vocabulary is one of "@vids"', array('@vids' => implode(', ', $names), '@identifier' => $context->identifier));
-}
-
+  return format_plural(count($names), '@identifier vocabulary is "@vids"', '@identifier vocabulary is one of "@vocabularies"', array('@vocabularies' => implode(', ', $names), '@identifier' => $context->identifier));

@vids needs to be replaced everywhere in the format_plural call. I've fixed this in the attached patch, but this patch needs more review, since I'm not actually using it and found a workaround.

caschbre’s picture

The workaround in #3 to use the taxonomy term bundle seems to have worked for me as well.

guddo’s picture

Status: Needs review » Needs work

Since this is not yet reviewed, I just tested it with 7.x-1.3:

Notice: Undefined index: vocabularies in ctools_term_vocabulary_ctools_access_summary() (line 76 of ctools/plugins/access/term_vocabulary.inc).

dasRicardo’s picture

Version: 7.x-1.x-dev » 7.x-1.3
Component: Page Manager » Plugins system
Assigned: Unassigned » dasRicardo
FileSize
3.68 KB

Hello,

I have rewritten the term_vocabulary access plugin to use vocabulary_maschinename instead of vid.

dasRicardo’s picture

Status: Needs work » Needs review
R.Hendel’s picture

Assigned: dasRicardo » Unassigned
Status: Needs review » Reviewed & tested by the community
FileSize
2.39 KB

Hi,
I patched ctools and tested functionality. Everything works as expected so I think, that everything is fine.

Warning:
After patching ctools it's neccessairy to rebuild your all of your features which uses vocabularies as display conditions!

Attached you'll find a git diff of exported features source after patching compared with unpatched source.
You'll find, that everywhere vids are replaced through machine-readables.

dawehner’s picture

Just to be clear, will existing sites still work or have the features to be updated first?

R.Hendel’s picture

After patching the system will work in a sense, that there's no whitescreen.
You can access panel-ui and edit all your panels pages as before. The display-conditions are still there, but they have lost connection to former vocabulary.

So you have to reorganize all your panels/features using vocabularies as a display conditions as panels won't understand now "'vids' => array(" like it did before patching. All you have to do is to edit each variants display condition and tell system which vocabulary should be listened on.

So your panels conditions won't work as expected after patching ctools. But the entire system is still running.

dasRicardo’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
4.37 KB

Hello,

after talking with dawehner and R.Hendel, I have rewritten the plugin again to add a helper function that maps the vid from the old features to the new maschine_name value.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Ralf promised to do another manual test, but I think this is already ready to fly.

+++ b/plugins/access/term_vocabulary.incundefined
@@ -73,15 +81,42 @@ function ctools_term_vocabulary_ctools_access_summary($conf, $context) {
+
+/**
+ * Helper function to map the vids from old features to the new machine_name.
+ * @param $conf
+ */
+function _ctools_term_vocabulary_ctools_access_map_vids(&$conf) {

Just in case you want to improve stuff: https://drupal.org/node/1354 ... add @param array $conf, and describe that $conf is altered.

damiankloip’s picture

+++ b/plugins/access/term_vocabulary.incundefined
@@ -73,15 +81,42 @@ function ctools_term_vocabulary_ctools_access_summary($conf, $context) {
+    '@maschine_names' => implode(', ', $names),

maschine names?

Otherwise, I agree, looks good to fly.

R.Hendel’s picture

FileSize
77.85 KB

When testing the patch I found, that
- patched ctools without changing preexisting features leaves page absolutely intact.
- To updated preexisting entrys you have to go into pane-condition and save settings. You don't have to change settings for this. (see attached screenshot)
- After saving panel ctools will export machine-readables instead of vids.

So from my point of view everything works fine. :-)

1586324-11.png

dawehner’s picture

Let's call it denglish

dasRicardo’s picture

Hello,

thanks for all your reviews, and sorry for my English :) I fix the issues and think everything is fine now.

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for all the manual tests, reviews etc.

Committed and pushed to 7.x-1.x

http://drupalcode.org/project/ctools.git/commit/e81da7a

Status: Fixed » Closed (fixed)

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

hefox’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
hessam61’s picture

Issue summary: View changes

Hello,

I'm experiencing this issue with the latest version of ctools, 7.x-1.4. Any idea?

paskainos’s picture

I too have recently experienced this issue with version 7.x-1.4.

emmene-moi’s picture

Status: Closed (fixed) » Reviewed & tested by the community

Has been removed from dev and production branches. Someone might have mixed merges.
Please include the patch again or add some kind of justification of this disappeared commit here.

emmene-moi’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Sorry, mixed with term_parent. Exists in commit.