8000 Remove default plugin creation by chaosk · Pull Request #6468 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

Remove default plugin creation #6468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove default_plugins from the docs
  • Loading branch information
Krzysztof Socha committed Aug 6, 2018
commit 85e0968b095cbb34b556de371ada0865dd676c60
13 changes: 3 additions & 10 deletions cms/tests/test_placeholder.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,7 @@ def test_get_placeholder_conf(self):
'main': {
'name': 'main content',
'plugins': ['TextPlugin', 'LinkPlugin'],
'default_plugins': [
{
'plugin_type': 'TextPlugin',
'values': {
'body': '<p>Some default text</p>'
},
},
],
'language_fallback': False,
},
'layout/home.html main': {
'name': u'main content with FilerImagePlugin and limit',
Expand Down Expand Up @@ -499,8 +492,8 @@ def test_get_placeholder_conf(self):
returned = get_placeholder_conf('excluded_plugins', 'main', 'layout/other.html')
self.assertEqual(returned, TEST_CONF['layout/other.html main']['excluded_plugins'])
# test grandparent inherited value
returned = get_placeholder_conf('default_plugins', 'main', 'layout/other.html')
self.assertEqual(returned, TEST_CONF['main']['default_plugins'])
returned = get_placeholder_conf('language_fallback', 'main', 'layout/other.html')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

language_fallback was removed

self.assertEqual(returned, TEST_CONF['main']['language_fallback'])
# test generic configuration
returned = get_placeholder_conf('plugins', 'something')
self.assertEqual(returned, TEST_CONF[None]['plugins'])
Expand Down
73 changes: 0 additions & 73 deletions docs/reference/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,6 @@ Example::
'extra_context': {"width":640},
'name': gettext("Content"),
'language_fallback': True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

'default_plugins': [
{
'plugin_type': 'TextPlugin',
'values': {
'body':'<p>Lorem ipsum dolor sit amet...</p>',
},
},
],
'child_classes': {
'TextPlugin': ['PicturePlugin', 'LinkPlugin'],
},
Expand Down Expand Up @@ -293,71 +285,6 @@ matches; if the same configuration is retrieved for the ``content`` placeholder
it falls back to the fallback languages as specified in :setting:`CMS_LANGUAGES`.
Defaults to ``True`` since version 3.1.

.. _placeholder_default_plugins:

``default_plugins``
You can specify the list of default plugins which will be automatically
added when the placeholder will be created (or rendered).
Each element of the list is a dictionary with following keys :

``plugin_type``
The plugin type to add to the placeholder
Example : ``TextPlugin``

``values``
Dictionary to use for the plugin creation.
It depends on the ``plugin_type``. See the documentation of each
plugin type to see which parameters are required and available.
Example for a text plugin:
``{'body':'<p>Lorem ipsum</p>'}``
Example for a link plugin:
``{'name':'Django-CMS','url':'https://www.django-cms.org'}``

``children``
It is a list of dictionaries to configure default plugins
to add as children for the current plugin (it must accepts children).
Each dictionary accepts same args than dictionaries of
``default_plugins`` : ``plugin_type``, ``values``, ``children``
(yes, it is recursive).

Complete example of default_plugins usage::

CMS_PLACEHOLDER_CONF = {
'content': {
'name' : _('Content'),
'plugins': ['TextPlugin', 'LinkPlugin'],
'default_plugins':[
{
'plugin_type':'TextPlugin',
'values':{
'body':'<p>Great websites : %(_tag_child_1)s and %(_tag_child_2)s</p>'
},
'children':[
{
'plugin_type':'LinkPlugin',
'values':{
'name':'django',
'url':'https://www.djangoproject.com/'
},
},
{
'plugin_type':'LinkPlugin',
'values':{
'name':'django-cms',
'url':'https://www.django-cms.org'
},
# If using LinkPlugin from djangocms-link which
# accepts children, you could add some grandchildren :
# 'children' : [
# ...
# ]
},
]
},
]
}
}

``plugin_modules``
A dictionary of plugins and custom module names to group plugin in the
toolbar UI.
Expand Down
0