-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathAbstractNetworkPresenter.php
More file actions
42 lines (33 loc) · 1.2 KB
/
AbstractNetworkPresenter.php
File metadata and controls
42 lines (33 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
declare( strict_types = 1 );
namespace MediaWiki\Extension\Network\NetworkFunction;
use Html;
abstract class AbstractNetworkPresenter implements NetworkPresenter {
private static $idCounter = 1;
/**
* @var string
*/
protected $html = '';
public function setHtml( ResponseModel $viewModel ): void {
$this->html =
Html::element(
'div',
[
'id' => 'network-viz-' . (string)self::$idCounter++,
'class' => $viewModel->cssClass,
'data-pages' => json_encode( $viewModel->pageNames ),
'data-excludedpages' => json_encode( $viewModel->excludedPages ),
'data-excludednamespaces' => json_encode( $viewModel->excludedNamespaces ),
'data-options' => json_encode( $viewModel->visJsOptions ),
'data-enabledisplaytitle' => json_encode( $viewModel->enableDisplayTitle ),
'data-labelmaxlength' => json_encode( $viewModel->labelMaxLength ),
'data-allowonlylinkstopages' => json_encode( $viewModel->AllowOnlyLinksToPages),
'data-allowlinkexpansion' => json_encode( $viewModel->AllowLinkExpansion),
]
);
}
public function setTooManyPagesError(): void {
// TODO: i18n
$this->html = 'Too many pages. Can only show connections for up to 100 pages.';
}
}