From ffecb6553d56cec59e1610edde2fa47ffbca6e30 Mon Sep 17 00:00:00 2001 From: Josua2012 Date: Fri, 1 Feb 2013 18:42:32 +0100 Subject: [PATCH] Fix Object::has_extension deprecated('xx','xx') --- code/controller/TranslatableCMSMainExtension.php | 4 ++-- code/forms/LanguageDropdownField.php | 12 ++++++------ code/model/Translatable.php | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/code/controller/TranslatableCMSMainExtension.php b/code/controller/TranslatableCMSMainExtension.php index c5dd61f..ba04454 100644 --- a/code/controller/TranslatableCMSMainExtension.php +++ b/code/controller/TranslatableCMSMainExtension.php @@ -89,7 +89,7 @@ class TranslatableCMSMainExtension extends Extension { } function updateEditForm(&$form) { - if($form->getName() == 'RootForm' && Object::has_extension('SiteConfig',"Translatable")) { + if($form->getName() == 'RootForm' && SiteConfig::has_extension("Translatable")) { $siteConfig = SiteConfig::current_site_config(); $form->Fields()->push(new HiddenField('Locale','', $siteConfig->Locale)); } @@ -211,7 +211,7 @@ class TranslatableCMSMainExtension extends Extension { * @return boolean */ function IsTranslatableEnabled() { - return Object::has_extension('SiteTree', 'Translatable'); + return SiteTree::has_extension('Translatable'); } } \ No newline at end of file diff --git a/code/forms/LanguageDropdownField.php b/code/forms/LanguageDropdownField.php index 807dfea..5bfcbaa 100755 --- a/code/forms/LanguageDropdownField.php +++ b/code/forms/LanguageDropdownField.php @@ -77,11 +77,11 @@ class LanguageDropdownField extends GroupedDropdownField { return 'languagedropdown dropdown'; } - public function getAttributes() { - return array_merge( - parent::getAttributes(), - array('data-locale-url' => $this->Link('getLocaleForObject')) - ); + public function getAttributes() { + return array_merge( + parent::getAttributes(), + array('data-locale-url' => $this->Link('getLocaleForObject')) + ); } /** @@ -93,7 +93,7 @@ class LanguageDropdownField extends GroupedDropdownField { $id = (int)$this->getRequest()->requestVar('id'); $class = Convert::raw2sql($this->getRequest()->requestVar('class')); $locale = Translatable::get_current_locale(); - if ($id && $class && class_exists($class) && Object::has_extension($class, 'Translatable')) { + if ($id && $class && class_exists($class) && $class::has_extension('Translatable')) { // temporarily disable locale filter so that we won't filter out the object Translatable::disable_locale_filter(); $object = DataObject::get_by_id($class, $id); diff --git a/code/model/Translatable.php b/code/model/Translatable.php index 4ebb4ec..13fff60 100755 --- a/code/model/Translatable.php +++ b/code/model/Translatable.php @@ -495,7 +495,7 @@ class Translatable extends DataExtension implements PermissionProvider { */ static function is_enabled() { if(class_exists('SiteTree')){ - return Object::has_extension('SiteTree', 'Translatable'); + return SiteTree::has_extension('Translatable'); }else{ return false; } @@ -1454,7 +1454,7 @@ class Translatable extends DataExtension implements PermissionProvider { } function providePermissions() { - if(!Object::has_extension('SiteTree', 'Translatable') || !class_exists('SiteTree')) return false; + if(!SiteTree::has_extension('Translatable') || !class_exists('SiteTree')) return false; $locales = self::get_allowed_locales();