Wikimedia Developer Support

Extension is not displaying Images

Hello, I created an extension which displays a dynamic table on mediawiki page.
Extension directory is such that:

  • extensions/Filter/includes/FilterHooks.php
  • extensions/Filter/resources/images

I found 3 ways to add images. I am using all of them, but none of them seems to work. Can someone help me ?

This is what I see on my mediawiki page:

Fowlling code is in the FilterHooks.php:

public static function onParserFirstCallInit(Parser &$parser ) {
		$parser->setHook( 'Filter', [ self::class, 'render' ] );
		
	}
	
	public static function render($input, $args, Parser $parser, PPFrame $frame){

		// Add required CSS & JS via ResourceLoader
		$po->addModuleStyles( 'ext.Filter.css' );
		$po->addModules( 'ext.Filter.js' );

		$output = '<div class = "modal" id = "myModal">';
			$output .= '<div class = "modal-content">';
				$output .= '<div class="head">';
		                $output .= '<div class="column">';
		                $output .= '<img class="demo cursor" src="blue.png" style="width:100%" onclick="currentSlide(1)" alt="Discovery Services" />';

		                $output .= '</div>';
		                $output .= '<div class="column">';
		                $output .= '<img class="demo cursor" src="{$wgExtensionAssetsPath}/Filter/resources/images/blue.png" style="width:100%" onclick="currentSlide(2)" alt="Assessment Services" />';
		           
		                $output .= '</div>';
		                $output .= '<div class="column">';
		                $output .= '<img class="demo cursor" src="Filter/resources/images/blue.png" style="width:100%" onclick="currentSlide(5)" alt="Adoption Services" />';
		                $output .= '</div>';
		            $output .= '</div>';
´´´
1 Like

That code doesn’t really make sense. What’s $po? What’s $output? (Is that being returned? The code seems cut off.)

1 Like