Closed (outdated)
Project:
Chaos Tool Suite (ctools)
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Aug 2009 at 07:57 UTC
Updated:
25 Feb 2016 at 04:43 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
sdboyer commentedMy immediate reaction is that b) sounds great. There's no need to replace the existing implementation (and keeping it around is best so as to avoid any backwards-compat issues), so I'd welcome a patch that took that approach.
Comment #2
merlinofchaos commentedDoesn't profile_fields.inc cover this? It allows you to select a category.
Comment #3
markus_petrux commentedNope. profile_fields.inc covers profile.module.
I wanted to mean profile categories as built by user_build_content() in user.module. This is what user_profile.inc implements, but it wants to output all categories. BTW, this content type does not work. hook_user('view') does not return data, rather it builds $account->content. This is a different issue, though... or maybe not.
One problem I see if we want to provide a form to select categories, is that we don't have a real user context yet, so we can only guess profile categories by using the current user account, or something similar. So ideally, we would have to provide a method that allows us to select profile categories at runtime. We already have hook_profile_alter(), but this is also invoked by user module when building the user profile page. So, maybe we could add an additional drupal_alter() here, say hook_ctools_profile_alter($account, $subtype, $conf, $panel_args, $context). ¿?
Comment #4
markus_petrux commentedI have filed a separate issue, bug report, to fix user_profile content type: #569508: Fix and clean up of user_profile content type.
Once that one is fixed it should be easy to focus on how we could extend this content type to add the ability to choose user profile elements, so that we can position them independently on a pane.
Comment #5
markus_petrux commentedNow that the other patch has been committed, I believe it is now easier to see what can done here.
I've been thinking about it for a while, and it is not possible to guess which user view categories and elements are going to be available in real-time. Note that these categories are added by 3rd party module using hook_user('view'), and they may not generate anything depending on several factors, user pesmissions, settings, etc.
So I think if we want to be able to show only one set of these items in panels, we need some kind of real-time hook. Here's what I think it could be done.
1) We can add a text field to the settings form of this user_profile content type. It could be labelled "keyword", for example. And the form (which is now empty), becomes something like this:
2) This keyword is attached to the $account object before user_build_content() is invoked. And user module will then invokes hook_profile_alter() where we can check for the ctools keyword we added here, and alter the $user->content structure accordingly.
3) Our implementation of hook_profile_alter() could look like this:
Attached patch implements this. Thoughts?
Comment #6
markus_petrux commentedJust wanted to mention that I do not really need this feature in CTools. I'm just using a custom module because I need to implement custom code for my hook_profile_alter().
I'm leaving this issue as-is, though, just in case it can be useful to others. ;-)
If there was a way to know ahead of time what can come from hook_user('view') implementations, then it would have been easier to implement this in a more generic way that's easy to setup, but unfortunately there isn't, and we need to use custom code, so...
Comment #7
merlinofchaos commentedI dunno if I like this patch. I see where you're coming from, but it's some pretty scary code. I can't begin to guess what situations it will fail in.
Comment #8
merlinofchaos commentedExiling util/unless someone wants to carry this further forward. =)
Comment #9
japerryClosing this issue as outdated as Drupal 6 ctools is not supported. If this issue is relevant for Drupal 7, feel free to re-open and mark for Drupal 7 (or 8)