Skip to content

Commit cea076e

Browse files
author
Thai Wood
committed
Add id to table rows by using table id and row id
1 parent 69d3ffd commit cea076e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

inline-gdocs-viewer.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,8 @@ private function dataToHtml ($r, $options, $caption = '') {
592592
$id = ( 0 === $this->invocations )
593593
? 'igsv-' . $this->getDocId( $options['key'] )
594594
: "igsv-{$this->invocations}-" . $this->getDocId( $options['key'] );
595-
$html = '<table id="' . esc_attr( $id ) . '"';
595+
$id = esc_attr( $id );
596+
$html = '<table id="$id"';
596597
// Prepend a space character onto the 'class' value, if one exists.
597598
if ( ! empty( $options['class'] ) ) {
598599
$options['class'] = " {$options['class']}";
@@ -613,7 +614,7 @@ private function dataToHtml ($r, $options, $caption = '') {
613614

614615
$html .= "<thead>\n";
615616
foreach ( $thead as $v ) {
616-
$html .= "<tr class=\"row-$ir " . $this->evenOrOdd( $ir ) . "\">";
617+
$html .= "<tr id=\"$id-row-$ir\" class=\"row-$ir " . $this->evenOrOdd( $ir ) . "\">";
617618
$ir++;
618619
$ic = 1; // reset column counting
619620
foreach ( $v as $th ) {
@@ -628,7 +629,7 @@ private function dataToHtml ($r, $options, $caption = '') {
628629
if ( $tfoot ) {
629630
$html .= "<tfoot>\n";
630631
foreach ( $tfoot as $v ) {
631-
$html .= "<tr class=\"row-$ir " . $this->evenOrOdd( $ir ) . "\">";
632+
$html .= "<tr id=\"$id-row-$ir\" class=\"row-$ir " . $this->evenOrOdd( $ir ) . "\">";
632633
$ir++;
633634
$ic = 1; // reset column counting
634635
foreach ( $v as $td ) {
@@ -644,7 +645,7 @@ private function dataToHtml ($r, $options, $caption = '') {
644645

645646
$html .= "<tbody>\n";
646647
foreach ( $tbody as $v ) {
647-
$html .= "<tr class=\"row-$ir " . $this->evenOrOdd( $ir ) . "\">";
648+
$html .= "<tr id=\"$id-row-$ir\" class=\"row-$ir " . $this->evenOrOdd( $ir ) . "\">";
648649
$ir++;
649650
$ic = 1; // reset column counting
650651
foreach ( $v as $td ) {

0 commit comments

Comments
 (0)