diff --git a/taccsite_cms/contrib/bootstrap4_djangocms_link/cms_plugins.py b/taccsite_cms/contrib/bootstrap4_djangocms_link/cms_plugins.py new file mode 100644 index 000000000..9de684a61 --- /dev/null +++ b/taccsite_cms/contrib/bootstrap4_djangocms_link/cms_plugins.py @@ -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 diff --git a/taccsite_cms/contrib/bootstrap4_djangocms_picture/cms_plugins.py b/taccsite_cms/contrib/bootstrap4_djangocms_picture/cms_plugins.py new file mode 100644 index 000000000..939bb5069 --- /dev/null +++ b/taccsite_cms/contrib/bootstrap4_djangocms_picture/cms_plugins.py @@ -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 diff --git a/taccsite_cms/settings.py b/taccsite_cms/settings.py index 190c1d309..93ead3cfd 100644 --- a/taccsite_cms/settings.py +++ b/taccsite_cms/settings.py @@ -238,6 +238,9 @@ def getsecrets(): # SEE: https://stackoverflow.com/a/37150997 'test_without_migrations', 'taccsite_cms', + # Restore djangocms plugins that bootstrap4 hides + 'taccsite_cms.contrib.bootstrap4_djangocms_link', + 'taccsite_cms.contrib.bootstrap4_djangocms_picture', # TODO: Extract TACC CMS UI components into pip-installable plugins # FAQ: The djangocms_bootstrap4 library can serve as an example 'taccsite_cms.contrib.taccsite_sample',