Commit 33009f53 authored by willzyx's avatar willzyx

Issue #2731581 by willzyx: Remove unused and legacy functions

parent 0182817a
api_url: 'api.drupal.org'
page_alter: FALSE
raw_names: FALSE
error_handlers:
......
......@@ -4,9 +4,6 @@ devel.settings:
type: config_object
label: 'Devel settings'
mapping:
api_url:
type: string
label: 'Drupal.org api url'
page_alter:
type: boolean
label: 'Page alter'
......
......@@ -14,9 +14,6 @@ define('DEVEL_ERROR_HANDLER_BACKTRACE_DPM', 4);
define('DEVEL_MIN_TEXTAREA', 50);
use Drupal\comment\CommentInterface;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Render\Markup;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\Query\AlterableInterface;
use Drupal\Core\Entity\EntityInterface;
......@@ -219,21 +216,6 @@ function backtrace_error_handler($error_level, $message, $filename, $line, $cont
}
}
/**
* Returns the core version.
*/
function devel_get_core_version($version) {
$version_parts = explode('.', $version);
// Map from 4.7.10 -> 4.7
if ($version_parts[0] < 5) {
return $version_parts[0] . '.' . $version_parts[1];
}
// Map from 5.5 -> 5 or 6.0-beta2 -> 6
else {
return $version_parts[0];
}
}
/**
* Implements hook_page_attachments_alter().
*/
......@@ -243,21 +225,6 @@ function devel_page_attachments_alter(&$page) {
}
}
/**
* Devel's t_safe() function.
*/
function t_safe($string, $args) {
// get_t() caused problems here with the theme registry after changing on
// admin/build/modules. The theme_get_registry() call is needed!
if (function_exists('t') && function_exists('theme_get_registry')) {
theme_get_registry();
return t($string, $args);
}
else {
strtr($string, $args);
}
}
/**
* Prints an object using either Kint (if enabled) or devel_print_object().
*
......@@ -555,17 +522,6 @@ function ddebug_backtrace($return = FALSE, $pop = 0, $options = DEBUG_BACKTRACE_
}
}
/**
* Deletes all files in a dir.
*/
function devel_empty_dir($dir) {
foreach (new DirectoryIterator($dir) as $file_info) {
if ($file_info->isFile()) {
unlink($file_info->getPathname());
}
}
}
/*
* Migration-related functions.
*/
......@@ -649,19 +605,6 @@ function devel_form_system_modules_alter(&$form, FormStateInterface $form_state)
}
}
/**
* Processes variables for block.tpl.php.
*
* Adding a module block class.
*
* @todo remove when http://drupal.org/node/1896098 gets in core.
*/
function devel_preprocess_block(&$variables) {
if (isset($variables['block']) && $variables['block']->module == 'devel') {
$variables['attributes']['class'][] = drupal_html_class('block-' . $variables['elements']['#block']->get('plugin'));
}
}
/**
* Implements hook_query_TAG_alter().
*
......
......@@ -68,10 +68,6 @@ class SettingsForm extends ConfigFormBase {
$current_url = Url::createFromRequest($request);
$devel_config = $this->config('devel.settings');
$form['api_url'] = array('#type' => 'textfield',
'#title' => t('API Site'),
'#default_value' => $devel_config->get('api_url'),
'#description' => t('The base URL for your developer documentation links. You might change this if you run <a href=":url">api.module</a> locally.', array(':url' => Url::fromUri('http://drupal.org/project/api')->toString())));
$form['page_alter'] = array('#type' => 'checkbox',
'#title' => t('Display $page array'),
'#default_value' => $devel_config->get('page_alter'),
......@@ -168,7 +164,6 @@ class SettingsForm extends ConfigFormBase {
public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state->getValues();
$this->config('devel.settings')
->set('api_url', $values['api_url'])
->set('page_alter', $values['page_alter'])
->set('raw_names', $values['raw_names'])
->set('error_handlers', $values['error_handlers'])
......
<?php
/**
* @file
* Support module for Devel testing.
*/
/**
* Implements hook_file_download().
*/
function devel_test_file_download($uri) {
$default_uri = \Drupal::state()->get('devel.test_file_download') ? : FALSE;
if ($default_uri === $uri) {
return array('X-Owned-By' => 'devel_test');
}
}
......@@ -5,28 +5,3 @@ devel.simple_page:
_title: 'Simple Page'
requirements:
_permission: 'access devel information'
devel.silent_global:
path: '/devel-silent/global-shoutdown'
defaults:
_controller: '\Drupal\devel_test\Controller\DevelSilentTestController::globalShoutdown'
_title: 'Devel shoutdown'
requirements:
_permission: 'access devel information'
devel.silent_route_parameter:
path: '/devel-silent/route-requirement'
defaults:
_controller: '\Drupal\devel_test\Controller\DevelSilentTestController::develSilentRouteRequirement'
_title: 'Devel settings'
requirements:
_permission: 'access devel information'
_devel_silent: 'TRUE'
devel.silent_json:
path: '/devel-silent/json'
defaults:
_controller: '\Drupal\devel_test\Controller\DevelSilentTestController::jsonResponse'
_title: 'Devel settings'
requirements:
_permission: 'access devel information'
<?php
/**
* @file
* Contains \Drupal\devel_test\Controller\DevelSilentTestController.
*/
namespace Drupal\devel_test\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\JsonResponse;
/**
* Returns responses for devel module routes.
*/
class DevelSilentTestController extends ControllerBase {
/**
* Tests that devel is disabled if $GLOBALS['devel_shutdown'] is set.
*
* @return array
* A render array.
*/
public function globalShoutdown() {
$GLOBALS['devel_shutdown'] = FALSE;
return [
'#markup' => $this->t('$GLOBALS[\'devel_shutdown\'] = FALSE forces devel to be inactive.'),
];
}
/**
* Tests that devel is disabled if response come from routes that are
* declared with '_devel_silent' requirement.
*
* @return array
* A render array.
*/
public function develSilentRouteRequirement() {
return [
'#markup' => $this->t('"_devel_silent" route requirement forces devel to be inactive.'),
];
}
/**
* Tests that devel is disabled if is reyurned a JsonResponse response.
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
* A json response.
*/
public function jsonResponse() {
$data = ['data' => 'Devel is active only on HtmlResponse.'];
return new JsonResponse($data);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment