File tree Expand file tree Collapse file tree 1 file changed +27
-3
lines changed
liens-morts-detector-jlg/includes Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -368,10 +368,34 @@ protected function column_context_excerpt($item) {
368368 $ tooltip_source = wp_strip_all_tags ($ tooltip_source );
369369 }
370370
371+ $ row_id = isset ($ item ['id ' ]) ? absint ($ item ['id ' ]) : 0 ;
372+ $ occurrence_index = isset ($ item ['occurrence_index ' ]) ? absint ($ item ['occurrence_index ' ]) : 0 ;
373+
374+ $ identifier_parts = [];
375+ if ($ row_id > 0 ) {
376+ $ identifier_parts [] = 'r ' . $ row_id ;
377+ }
378+ if ($ occurrence_index > 0 ) {
379+ $ identifier_parts [] = 'o ' . $ occurrence_index ;
380+ }
381+
382+ if (empty ($ identifier_parts )) {
383+ $ identifier_parts [] = 'f ' . substr (md5 ($ excerpt ), 0 , 8 );
384+ }
385+
386+ $ description_id = 'blc-context-excerpt-desc- ' . implode ('- ' , $ identifier_parts );
387+
388+ $ description_id_attr = esc_attr ($ description_id );
389+ $ full_excerpt_attr = esc_attr ($ tooltip_source );
390+ $ full_excerpt_text = esc_html ($ tooltip_source );
391+ $ excerpt_text = esc_html ($ excerpt );
392+
371393 return sprintf (
372- '<span class="blc-context-excerpt" title="%s">%s</span> ' ,
373- esc_attr ($ tooltip_source ),
374- esc_html ($ excerpt )
394+ '<span class="blc-context-excerpt-wrapper" aria-describedby="%1$s"><span class="blc-context-excerpt" title="%2$s" data-full-excerpt="%2$s">%3$s</span><span id="%1$s" class="screen-reader-text">%4$s</span></span> ' ,
395+ $ description_id_attr ,
396+ $ full_excerpt_attr ,
397+ $ excerpt_text ,
398+ $ full_excerpt_text
375399 );
376400 }
377401
You can’t perform that action at this time.
0 commit comments