Create basic content function
Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
33
includes/AnnotationHooks.php
Normal file
33
includes/AnnotationHooks.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user