FYI, I resolved the issue by looping over the plugins in the project
and looking to see if they have a
pluginnamePluginPkContextCMSExtension class. If they do, I ask that
class for a list of global buttons.

This seems reasonable in practice because I only look for these when a
user is logged in with editing privileges, and it would be unusual for
a single Symfony project to use, let's say, 50 plugins. And it's
pretty elegant from an OOP perspective. But I'd be interested in the
thoughts of others on whether there's another way to do it with the
same elegance and better performance.

Keeping this stuff in a pkContextCMS-specific class for each plugin
seems cleaner than adding CMS-specific methods to the
pluginConfiguration class, which I also considered.

My getExtensionClasses() method follows.

(I also upgraded my global buttons to be a proper class and so on, and
I check the extension classes to see whether they actually have a
getGlobalButtons method before interrogating them.)

-Tom

  static public function getExtensionClasses()
  {
    $classes = array();
    $plugins = sfContext::getInstance()->getConfiguration()->getPlugins();
    foreach ($plugins as $plugin)
    {
      $class = $plugin . "PkContextCMSExtension";
      if (class_exists($class, true))
      {
        $classes[] = $class;
      }
    }
    if (class_exists("ProjectPkContextCMSExtension"))
    {
      $classes[] = "ProjectPKContextCMSExtension";
    }
    return $classes;
  }



-- 
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to