-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed merge of quick/support-plugins-unadulterated-by-bootstrap--f…
…or-main at commit eda34fa
- Loading branch information
1 parent
265a800
commit 938db90
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
taccsite_cms/contrib/bootstrap4_djangocms_link/cms_plugins.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Reregister unregistered LinkPlugin without uninstalling Bootstrap4's | ||
# FAQ: A Bootstrap link is undesirable but may be used by migrated legacy sites | ||
# TODO: Drop try/except & load non-standard plugin set for migrated legacy sites | ||
# FAQ: If we can import both plugins, then re-register LinkPlugin | ||
# (because Bootstrap4Link unregistered LinkPlugin) | ||
try: | ||
from cms.plugin_pool import plugin_pool | ||
from djangocms_link.cms_plugins import LinkPlugin | ||
from djangocms_bootstrap4.contrib.bootstrap4_link.cms_plugins import Bootstrap4LinkPlugin | ||
|
||
# Restore original fields | ||
# SEE: https://github.com/django-cms/djangocms-bootstrap4/blob/2.0.0/djangocms_bootstrap4/contrib/bootstrap4_link/cms_plugins.py#L26-L42 | ||
# SEE: https://github.com/django-cms/djangocms-link/blob/3.0.0/djangocms_link/cms_plugins.py#L20-L23 | ||
LinkPlugin.fieldsets[0][1]['fields'] = ( | ||
'name', | ||
('external_link', 'internal_link'), | ||
) | ||
|
||
# SEE: https://github.com/django-cms/djangocms-link/issues/163 | ||
plugin_pool.register_plugin(LinkPlugin) | ||
# CAVEAT: If import statement fails for reason other than Bootstrap presence, | ||
# then that failure, and the failure of this plugin, is silent | ||
except ImportError: | ||
pass |
15 changes: 15 additions & 0 deletions
15
taccsite_cms/contrib/bootstrap4_djangocms_picture/cms_plugins.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Reregister unregistered PicturePlugin without uninstalling Bootstrap4's | ||
# FAQ: A Bootstrap picture has superfluous options that are not always desirable | ||
# FAQ: If we can import both plugins, then re-register PicturePlugin | ||
# (because Bootstrap4Picture unregistered PicturePlugin) | ||
try: | ||
from cms.plugin_pool import plugin_pool | ||
from djangocms_picture.cms_plugins import PicturePlugin | ||
from djangocms_bootstrap4.contrib.bootstrap4_picture.cms_plugins import Bootstrap4PicturePlugin | ||
|
||
# SEE: https://github.com/django-cms/djangocms-bootstrap4/blob/master/djangocms_bootstrap4/contrib/bootstrap4_picture/cms_plugins.py#L54 | ||
plugin_pool.register_plugin(PicturePlugin) | ||
# CAVEAT: If import statement fails for reason other than Bootstrap presence, | ||
# then that failure, and the failure of this plugin, is silent | ||
except ImportError: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters