Projet

Général

Profil

Paste
Télécharger (6,57 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / ctools / help / context-content.html @ ba09eb79

1
<p>The CTools pluggable content system provides various pieces of content as discrete bits of data that can be added to other applications, such as Panels or Dashboard via the UI. Whatever the content is added to stores the configuration for that individual piece of content, and provides this to the content.</p>
2

    
3
<p>Each content type plugin will be contained in a .inc file, with subsidiary files, if necessary, in or near the same directory. Each content type consists of some information and one or more subtypes, which all use the same renderer. Subtypes are considered to be instances of the type. For example, the 'views' content type would have each view in the system as a subtype. Many content types will have exactly one subtype.</p>
4

    
5
<p>Because the content and forms can be provided via ajax, the plugin also provides a list of CSS and JavaScript information that should be available on whatever page the content or forms may be AJAXed onto.</p>
6

    
7
<p>For the purposes of selecting content from the UI, each content subtype will have the following information:</p>
8

    
9
<ul>
10
  <li>A title</li>
11
  <li>A short description</li>
12
  <li>A category [Do we want to add hierarchy categories? Do we want category to be more than just a string?]</li>
13
  <li>An icon [do we want multiple icons? This becomes a hefty requirement]</li>
14
</ul>
15

    
16
<p>Each piece of content provides one or more configuration forms, if necessary, and the system that includes the content will handle the data storage. These forms can be provided in sequence as wizards or as extra forms that can be accessed through advanced administration.</p>
17

    
18
<p>The plugin for a content type should contain:</p>
19

    
20
<dl>
21
  <dt>title</dt>
22
  <dd>For use on the content permissions screen.</dd>
23
  <dt>content types</dt>
24
  <dd>Either an array of content type definitions, or a callback that will return content type definitions. This callback will get the plugin definition as an argument.</dd>
25

    
26
  <dt>content type</dt>
27
  <dd>[Optional] Provide a single content type definition. This is only necessary if content types might be intensive.</dd>
28

    
29
  <dt>render callback</dt>
30
  <dd>The callback to render the content. Parameters:
31
    <dl>
32
      <dt>$subtype</dt>
33
      <dd>The name of the subtype being rendered. NOT the loaded subtype data.</dd>
34

    
35
      <dt>$conf</dt>
36
      <dd>The stored configuration for the content.</dd>
37

    
38
      <dt>$args</dt>
39
      <dd>Any arguments passed.</dd>
40

    
41
      <dt>$context</dt>
42
      <dd>An array of contexts requested by the required contexts and assigned by the configuration step.</dd>
43

    
44
      <dt>$incoming_content</dt>
45
      <dd>Any 'incoming content' if this is a wrapper.</dd>
46
    </dl>
47
  </dd>
48

    
49
  <dt>admin title</dt>
50
  <dd>A callback to provide the administrative title. If it is not a function, then it will be counted as a string to use as the admin title.</dd>
51

    
52
  <dt>admin info</dt>
53
  <dd>A callback to provide administrative information about the content, to be displayed when manipulating the content. It should contain a summary of configuration.</dd>
54

    
55
  <dt>edit form</dt>
56
  <dd>Either a single form ID or an array of forms *keyed* by form ID with the value to be used as the title of the form. %title me be used as a placeholder for the administrative title if necessary.
57
    Example:
58
<pre>array(
59
  'ctools_example_content_form_second' =&gt; t('Configure first form'),
60
  'ctools_example_content_form_first' =&gt; t('Configure second form'),
61
),
62
</pre>
63
The first form will always have required configuration added to it. These forms are normal FAPI forms, but you do not need to provide buttons, these will be added by the form wizard.
64
  </dd>
65

    
66
  <dt>add form</dt>
67
  <dd>[Optional] If different from the edit forms, provide them here in the same manner. Also may be set to FALSE to not have an add form.</dd>
68

    
69
  <dt>css</dt>
70
  <dd>A file or array of CSS files that are necessary for the content.</dd>
71

    
72
  <dt>js</dt>
73
  <dd>A file or array of javascript files that are necessary for the content to be displayed.</dd>
74

    
75
  <dt>admin css</dt>
76
  <dd>A file or array of CSS files that are necessary for the forms.</dd>
77

    
78
  <dt>admin js</dt>
79
  <dd>A file or array of JavaScript files that are necessary for the forms.</dd>
80

    
81
  <dt>extra forms</dt>
82
  <dd>An array of form information to handle extra administrative forms.</dd>
83

    
84
  <dt>no title override</dt>
85
  <dd>Set to TRUE if the title cannot be overridden.</dd>
86

    
87
  <dt>single</dt>
88
  <dd>Set to TRUE if this content provides exactly one subtype.</dd>
89

    
90
  <dt>render last</dt>
91
  <dd>Set to true if for some reason this content needs to render after other content. This is primarily used for forms to ensure that render order is correct.</dd>
92
</dl>
93

    
94
<p>TODO: many of the above callbacks can be assumed based upon patterns: modulename + '_' + name + '_' + function. i.e, render, admin_title, admin_info, etc.</p>
95

    
96
<p>TODO: Some kind of simple access control to easily filter out content.</p>
97

    
98
<p>The subtype definition should contain:</p>
99

    
100
<dl>
101
  <dt>title</dt>
102
  <dd>The title of the subtype.</dd>
103

    
104
  <dt>icon</dt>
105
  <dd>The icon to display for the subtype.</dd>
106

    
107
  <dt>path</dt>
108
  <dd>The path for the icon if it is not in the same directory as the plugin.</dd>
109

    
110
  <dt>description</dt>
111
  <dd>The short description of the subtype, to be used when selecting it in the UI.</dd>
112

    
113
  <dt>category</dt>
114
  <dd>Either a text string for the category, or an array of the text string followed by the category weight.</dd>
115

    
116
  <dt>required context [Optional]</dt>
117

    
118
  <dd>Either a ctools_context_required or ctools_context_optional or array of contexts for this content. If omitted, no contexts are used.</dd>
119

    
120
  <dt>create content access [Optional]</dt>
121

    
122
  <dd>An optional callback to determine if a user can access this subtype. The callback will receive two arguments, the type and subtype.</dd>
123
</dl>
124

    
125
<h2>Rendered content</h2>
126

    
127
<p>Rendered content is a little more than just HTML.</p>
128

    
129
<dl>
130
  <dt>title</dt>
131
  <dd>The safe to render title of the content.</dd>
132

    
133
  <dt>content</dt>
134
  <dd>The safe to render HTML content.</dd>
135

    
136
  <dt>links</dt>
137
  <dd>An array of links associated with the content suitable for theme('links').</dd>
138

    
139
  <dt>more</dt>
140
  <dd>An optional 'more' link (destination only)</dd>
141

    
142
  <dt>admin_links</dt>
143
  <dd>Administrative links associated with the content, suitable for theme('links').</dd>
144

    
145
  <dt>feeds</dt>
146
  <dd>An array of feed icons or links associated with the content. Each member of the array is rendered HTML.</dd>
147

    
148
  <dt>type</dt>
149
  <dd>The content type.</dd>
150

    
151
  <dt>subtype</dt>
152
  <dd>The content subtype. These two may be used together as module-delta for block style rendering.</dd>
153
</dl>
154

    
155
<h2>Todo: example</h2>
156

    
157
<p>Todo after implementations are updated to new version.</p>