Alex Monk has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/70028


Change subject: Add ID to action=info table rows
......................................................................

Add ID to action=info table rows

MZMcBride wants to use these to highlight certain pieces of information.

Bug: 44252
Change-Id: Id4fd17e748c0fe3a9f4c51846abcaa8942fa5c50
---
M includes/actions/InfoAction.php
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/28/70028/1

diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php
index e3ea6fc..3c56ce7 100644
--- a/includes/actions/InfoAction.php
+++ b/includes/actions/InfoAction.php
@@ -121,7 +121,8 @@
                        foreach ( $infoTable as $infoRow ) {
                                $name = ( $infoRow[0] instanceof Message ) ? 
$infoRow[0]->escaped() : $infoRow[0];
                                $value = ( $infoRow[1] instanceof Message ) ? 
$infoRow[1]->escaped() : $infoRow[1];
-                               $table = $this->addRow( $table, $name, $value ) 
. "\n";
+                               $id = ( $infoRow[0] instanceof Message ) ? 
$infoRow[0]->getKey() : null;
+                               $table = $this->addRow( $table, $name, $value, 
$id ) . "\n";
                        }
                        $content = $this->addTable( $content, $table ) . "\n";
                }
@@ -156,10 +157,11 @@
         * @param string $table The table that will be added to the content
         * @param string $name The name of the row
         * @param string $value The value of the row
+        * @param string $id The ID to use for the 'tr' element
         * @return string The table with the row added
         */
-       protected function addRow( $table, $name, $value ) {
-               return $table . Html::rawElement( 'tr', array(),
+       protected function addRow( $table, $name, $value, $id ) {
+               return $table . Html::rawElement( 'tr', $id == null ? array() : 
array( 'id' => 'mw-' . $id ),
                        Html::rawElement( 'td', array( 'style' => 
'vertical-align: top;' ), $name ) .
                        Html::rawElement( 'td', array(), $value )
                );

-- 
To view, visit https://gerrit.wikimedia.org/r/70028
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4fd17e748c0fe3a9f4c51846abcaa8942fa5c50
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <kren...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to