@@ -192,12 +192,19 @@ CMSPluginBase Attributes and Methods Reference
192
192
193
193
Default: ``False ``
194
194
195
- Not all plugins are usable in text plugins. If your plugin *is * usable in a text plugin:
195
+ This attribute controls whether your plugin will be usable (and rendered)
196
+ in a text plugin. When you edit a text plugin on a page, the plugin will show up in
197
+ the *CMS Plugins * dropdown and can be configured and inserted. The output will even
198
+ be previewed in the text editor.
199
+
200
+ Of course, not all plugins are usable in text plugins. Therefore the default of this
201
+ attribute is ``False ``. If your plugin *is * usable in a text plugin:
196
202
197
203
* set this to ``True ``
198
- * make sure your plugin provides its own :meth: `icon_src `
204
+ * make sure your plugin provides its own :meth: `icon_alt `, this will be used as a tooltip in
205
+ the text-editor and comes in handy when you use multiple plugins in your text.
199
206
200
- See also: :attr: ` icon_src `, :attr: ` icon_alt `.
207
+ See also: :meth: ` icon_alt `, :meth: ` icon_src `.
201
208
202
209
203
210
**Methods **
@@ -326,18 +333,16 @@ CMSPluginBase Attributes and Methods Reference
326
333
327
334
.. method :: icon_alt()
328
335
329
- Although it is optional, authors of "text enabled" plugins should consider
330
- overriding this function as well .
336
+ By default :meth: ` icon_alt ` will return a string of the form: "[plugin type] -
337
+ [instance]", but can be modified to return anything you like .
331
338
332
339
This function accepts the ``instance `` as a parameter and returns a string to be
333
- used as the ``alt `` text for the plugin's icon which will appear as a tooltip in
334
- most browsers. This is useful, because if the same plugin is used multiple
335
- times within the same text plugin, they will typically all render with the
336
- same icon rendering them visually identical to one another. This ``alt `` text and
337
- related tooltip will help the operator distinguish one from the others.
340
+ used as the ``alt `` text for the plugin's preview or icon.
338
341
339
- By default :meth: `icon_alt ` will return a string of the form: "[plugin type] -
340
- [instance]", but can be modified to return anything you like.
342
+ Authors of text-enabled plugins should consider overriding this function as
343
+ it will be rendered as a tooltip in most browser. This is useful, because if
344
+ the same plugin is used multiple times, this tooltip can provide information about
345
+ its configuration.
341
346
342
347
:meth: `icon_alt ` takes 1 argument:
343
348
@@ -348,7 +353,7 @@ CMSPluginBase Attributes and Methods Reference
348
353
def icon_alt(self, instance):
349
354
return "%s - %s" % (force_text(self.name), force_text(instance))
350
355
351
- See also: :attr: `text_enabled `, :attr : `icon_src `.
356
+ See also: :attr: `text_enabled `, :meth : `icon_src `.
352
357
353
358
354
359
.. method :: icon_src(instance)
@@ -361,6 +366,9 @@ CMSPluginBase Attributes and Methods Reference
361
366
``True `` to return the path to an icon to display in the text of the text
362
367
plugin.
363
368
369
+ Since djangocms-text-ckeditor introduced inline previews of plugins, the icon
370
+ will not be rendered anymore.
371
+
364
372
icon_src takes 1 argument:
365
373
366
374
* ``instance ``: The instance of the plugin model
@@ -388,8 +396,6 @@ CMSPluginBase Attributes and Methods Reference
388
396
:class: `django.template.Context `, which will be used as context to render the
389
397
plugin template.
390
398
391
- .. versionadded :: 2.4
392
-
393
399
By default this method will add ``instance `` and ``placeholder `` to the
394
400
context, which means for simple plugins, there is no need to overwrite this
395
401
method.
0 commit comments