Add retro compatibility cms 3.4
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
+from distutils.version import LooseVersion
+from cms import __version__ as CMS_VERSION
from cms.extensions.toolbar import ExtensionToolbar
from cms.toolbar_pool import toolbar_pool
from cms.toolbar.items import Break
@@ -21,5 +23,8 @@ class IconFontToolbar(ExtensionToolbar):
page_extension, url = self.get_page_extension_admin()
if url:
position = current_page_menu.find_first(Break, identifier=PAGE_MENU_SECOND_BREAK)
+ if LooseVersion(CMS_VERSION) < LooseVersion('3.5'):
+ disabled = not self.toolbar.edit_mode
+ else:
disabled = not self.toolbar.edit_mode_active
current_page_menu.add_modal_item(_("Choose Icon Font"), position=position, url=url, disabled=disabled)
