Here's a collection of small changes I made to work with ctools & panels in D7.
I tried to group the changes by topic / file to make it easier to apply and review.

ctools-context-admin-form-definition:

  • Added several keys to form specific arrays to get rid of "Undefined index" notices
  • Removed unnecessary variable definitions ($position)
  • ctools_context_get_defaults needs review. Removed constructs that looked legacy
  • Removed trailing space


ctools-context-inc:

  • Added $plugin as parameter in some cases. Some of the function seem to rely on this information - but I can't remember which one exactly.
  • Create a more specific name for converters.
  • Use entity:user instead user to load user context.
  • Added additional check for $access['logic'] to make sure theres no "Undefined index" notice - needs review


ctools-context-theme-inc:

  • Prevent "Undefined index" notice. But I'm actually not sure if is / should be description optional.


ctools-field-inc:


ctools-notices-fixes:


ctools-vocabularies-and-terms:

  • Changed naming to be entity compliant.


ctools-views_panes-smarter-title:

  • Better title for views_panes.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merlinofchaos’s picture

One review. Still working.

diff --git views_content/plugins/content_types/views_panes.inc views_content/plugins/content_types/views_panes.inc
index 894c263..09b5897 100644
--- views_content/plugins/content_types/views_panes.inc
+++ views_content/plugins/content_types/views_panes.inc
@@ -90,7 +90,13 @@ function _views_content_panes_content_type($view, $display) {
 
   $title = $display->handler->get_option('pane_title');
   if (!$title) {
-    $title = $view->name;
+    $display_title = $display->display_title;
+    if (!$display_title) {
+      $title = $view->name;
+    }
+    else {
+      $title = $display_title . ' [' . $view->name . ']';
+    }
   }
 
   $description = $display->handler->get_option('pane_description');

Should be a translated title. Something like t('%display [%view]'). It should probably also be consistent with how views are listed in the block UI in the same circumstance.

merlinofchaos’s picture


@@ -594,8 +608,8 @@ function ctools_context_ajax_item_edit($mechanism = NULL, $type = NULL, $cache_k
 
 function ctools_context_get_defaults($plugin_definition) {
   $conf = array(
-    'identifier' => $plugin_definition['title'] . ($id > 1 ? ' ' . $id : ''),
-    'keyword' => ctools_get_keyword($object, $plugin_definition['keyword']),
+    'identifier' => $plugin_definition['title'],
+    'keyword' => $plugin_definition['keyword'],
     'name' => $plugin_definition['name'],
   );
 

I don't see how this can be right? Am I missing something?

EclipseGc’s picture

A lot of these look really great, but with this many changes, I'd much rather a handful of small patches need a little revisiting than re-rolling a 750 line patch regularly and often. Can I side track this train into getting some review on #951048: Support Subtypes for Arguments, Context and Relationship plugins before we go altering large sections of the code base again?

My patch is altering:

includes/content.menu.inc
includes/context.inc
includes/context.plugin-type.inc
plugins/access/term.inc
plugins/access/term_parent.inc
plugins/access/term_vocabulary.inc
plugins/arguments/entity_id.inc

The rest are new files.

I think specifically I'd like to see a hold on:

ctools-context-inc.patch
ctools-vocabularies-and-terms.patch

The rest are probably fine.

Eclipse

das-peter’s picture

Thank you guys for your feedback.

#1:
Changed it to how it's done in views_plugin_display_block.inc execute_hook_block_list().

#2:
Well, my approach was very lazy. There's no $id nor $object - thus remove the constructs.
Does anything obviously fail - if not = done.
Thus it's very likely that this isn't properly fixed - and if someone can give my a direction I'll fix it.
Btw. this seems the last place where ctools_get_keyword() was used.

#3:
Let's skip the patches here touched by #951048: Support Subtypes for Arguments, Context and Relationship plugins. I'll keep an eye on it and make later a reroll where necessary.

merlinofchaos’s picture

Status: Needs review » Needs work

Committed smarter title panes and context-theme.inc Marking the rest needs work.

das-peter’s picture

Patches cleaned:
ctools-plugins-admin-inc: Removed patch duplication
ctools-notices-fixes: Remove duplication of ctools-plugins-admin-inc.

merlinofchaos’s picture

Status: Needs work » Needs review

Resetting status

merlinofchaos’s picture

Status: Needs review » Fixed

Committed. I know there are more mostly related to entities; let's follow them up in separate issues as I'm having trouble tracking everything here.

Status: Fixed » Closed (fixed)

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

pillarsdotnet’s picture