/** * This method will delete every SiteTree instance in the given language */ public function removelang() { if (!Permission::check("ADMIN")) user_error("You must be an admin to remove a language", E_USER_ERROR); $translatedToDelete = Translatable::get_by_lang('SiteTree',$this->urlParams['ID']); foreach ($translatedToDelete as $object) { $object->delete(); } echo "Language {$this->urlParams['ID']} successfully removed"; }