Create basic content function

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
2026-05-17 11:16:19 -07:00
parent cbf305dd05
commit d39458d53b
6 changed files with 115 additions and 192 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace MediaWiki\Extension\AnatImageViewer;
use MediaWiki\MediaWikiServices;
use RequestContext;
use Html;
use ParserOutput;
class AnnotationHooks {
public static function registrationCallback() {
// Must match the name used in the 'ContentHandlers' section of extension.json
define( 'CONTENT_MODEL_ANNOTATION', 'annotation' );
}
/**
* Small helper function to display information on the browser console
*
* Usage:
* echo '<script>';
* self::console_log('logged string');
* echo '</script>';
*
* @param $data information to display
* @param bool $add_script_tags true to put information is inside complete script tag
*/
public static function console_log($data, $add_script_tags = false) {
$command = 'console.log('. json_encode($data, JSON_HEX_TAG).');';
if ($add_script_tags) {
$command = '<script>'. $command . '</script>';
}
echo $command;
}
}