[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/ctools/ctools_plugin_example/help/ -> Context-plugins--Creating-a--context--from-an-argument.html (source)

   1  <div id="node-13" class="node">
   2  
   3  
   4  
   5    
   6    <div class="content clear-block">
   7      <p>Now that we have a plugin for a simplecontext argument, we can create a plugin for a simplecontext context. </p>
   8  <p>Normally, a context would take an argument which is a key like a node ID (nid) and retrieve a more complex object from a database or whatever. In our example, we'll artificially transform the argument into an arbitrary "context" data object. </p>
   9  <p>plugins/contexts/simplecontext.inc implements our context.</p>
  10  <p>Note that there are actually two ways to create a context. The normal one, which we've been referring to, is to create a context from an argument. However, it is also possible to configure a context in a panel using the panels interface. This is quite inflexible, but might be useful for configuring single page. However, it means that we have a settings form for exactly that purpose. Our context would have to know how to create itself from a settings form as well as from an argument. Simplecontext can do that.</p>
  11  <p>A context plugin can also provide keywords that expose parts of its context using keywords like masterkeyword:dataitem. The node plugin for ctools has node:nid and node:title, for example. The simplecontext plugin here provides the simplest of keywords.</p>
  12   
  13    </div>
  14  
  15    <div class="clear-block">
  16      <div class="meta">
  17          </div>
  18  
  19        </div>
  20  
  21  </div>


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7