As per our conversation I have found that the custom php content type is only getting past the unknown context.

Comments

gordon’s picture

I did some more research and I found that adding a single like would allow you to select which context to use. This is perfect as I don't need to workout which context I need to grab.

diff --git a/content_types/custom_php.inc b/content_types/custom_php.inc
index f667289..869633e 100644
--- a/content_types/custom_php.inc
+++ b/content_types/custom_php.inc
@@ -80,6 +80,7 @@ function panels_admin_content_types_custom_php() {
         'path' => panels_get_path('content_types/custom'),
         'description' => t('Custom PHP block with access to Panels context data
         'category' => array(t('Custom'), -10),
+        'required context' => new panels_required_context(t('Select context'), 'any'),
       ),
     );
   }

I am not sure if this will work with a panel that has no contexts, but for my purpose it is exactly what I want.

gordon’s picture

Assigned: Unassigned » gordon
Status: Active » Needs review
StatusFileSize
new1.32 KB

Actually to fix this was very easy.

I fixed the use of optional context, and made a change the configuration forms so that if there is no required context it will display the optional context so you can specify a context of not to be past to the php code.
'
I have added to the custom_php an optional context of "any" so all contexts will be displayed.

sdboyer’s picture

StatusFileSize
new3.31 KB

OK, so...I'm a bit baffled as to how your patch is working for you :P

Attached is a patch that takes the final step that, at least for my master -dev working copy, fixes this problem.

sdboyer’s picture

Status: Needs review » Fixed

(after gordon's via-irc-thumbs-up)

Great. Committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

denis_sle’s picture

I'm using the last dev version ( panels-5.x-2.x-dev November 17, 2008) and I can see context only as admin user,
here is the code for custom php:

$block->content= '<xmp>'.print_r($context,1).'</xmp>';

for regular (loggedin) user , this code return:

panels_context Object
(
    [type] => none
    [data] => 
    [title] => Unknown context
    [page_title] => 
    [identifier] => 
    [argument] => 
    [keyword] => 
)

for admin user it return full context, all

denis_sle’s picture

Status: Closed (fixed) » Active
Chris Einkauf’s picture

Title: Custom PHP content type not being past all contexts » Custom PHP content type not being passed all contexts
sun.core’s picture

Status: Active » Closed (won't fix)

Sorry, but Panels for D5 will not see any further fixes, since Panels for D6 simply advanced too much and no one cares for D5.