From eb2804540feefc927002fdd21cfff7add8fdb8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Sun, 29 Mar 2020 16:09:50 -0300 Subject: [PATCH] Extract HTML from Index::getHtmlForDisplayIndexes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- .../Controllers/Table/RelationController.php | 2 +- .../Controllers/Table/StructureController.php | 2 +- libraries/classes/Index.php | 34 ------------------- templates/table/relation/common_form.twig | 19 ++++++++++- .../table/structure/display_structure.twig | 21 +++++++++--- 5 files changed, 37 insertions(+), 41 deletions(-) diff --git a/libraries/classes/Controllers/Table/RelationController.php b/libraries/classes/Controllers/Table/RelationController.php index 491fa1a486..93ff323a25 100644 --- a/libraries/classes/Controllers/Table/RelationController.php +++ b/libraries/classes/Controllers/Table/RelationController.php @@ -194,7 +194,7 @@ final class RelationController extends AbstractController 'dbi' => $this->dbi, 'default_sliders_state' => $GLOBALS['cfg']['InitialSlidersState'], 'foreignKeySupported' => $foreignKeySupported, - 'displayIndexesHtml' => $foreignKeySupported ? Index::getHtmlForDisplayIndexes() : null, + 'indexes_html' => $foreignKeySupported ? Index::getHtmlForIndexes($this->table, $this->db) : null, 'route' => $route, ]) ); diff --git a/libraries/classes/Controllers/Table/StructureController.php b/libraries/classes/Controllers/Table/StructureController.php index e273e89454..2d2911e81f 100644 --- a/libraries/classes/Controllers/Table/StructureController.php +++ b/libraries/classes/Controllers/Table/StructureController.php @@ -1331,7 +1331,7 @@ class StructureController extends AbstractController ], 'collations' => $collations, 'is_foreign_key_supported' => Util::isForeignKeySupported($engine), - 'displayIndexesHtml' => Index::getHtmlForDisplayIndexes(), + 'indexes_html' => Index::getHtmlForIndexes($this->table, $this->db), 'cfg_relation' => $this->relation->getRelationsParam(), 'hide_structure_actions' => $hideStructureActions, 'db' => $this->db, diff --git a/libraries/classes/Index.php b/libraries/classes/Index.php index 4831a5e403..e151d22e98 100644 --- a/libraries/classes/Index.php +++ b/libraries/classes/Index.php @@ -561,40 +561,6 @@ class Index return $this->_columns; } - /** - * Get HTML for display indexes - * - * @return string - */ - public static function getHtmlForDisplayIndexes() - { - $html_output = '
'; - $html_output .= self::getHtmlForIndexes( - $GLOBALS['table'], - $GLOBALS['db'] - ); - $html_output .= '' - . '
'; - - return $html_output; - } - /** * Show index data * diff --git a/templates/table/relation/common_form.twig b/templates/table/relation/common_form.twig index 9a51f165fc..3b27b66a7c 100644 --- a/templates/table/relation/common_form.twig +++ b/templates/table/relation/common_form.twig @@ -217,7 +217,24 @@ + {% if foreignKeySupported %} - {{ displayIndexesHtml|raw }} +
+ {{ indexes_html|raw }} + + +
{% endif %} + {% endblock %} diff --git a/templates/table/structure/display_structure.twig b/templates/table/structure/display_structure.twig index 45dbc9bc9d..045fde74c5 100644 --- a/templates/table/structure/display_structure.twig +++ b/templates/table/structure/display_structure.twig @@ -443,10 +443,23 @@ {% endif %} -{# Displays indexes #} -{% if not tbl_is_view and not db_is_system_schema - and 'ARCHIVE' != tbl_storage_engine %} - {{ displayIndexesHtml|raw }} +{% if not tbl_is_view and not db_is_system_schema and tbl_storage_engine != 'ARCHIVE' %} +
+ {{ indexes_html|raw }} + + +
{% endif %} {# Display partition details #}