3 * This file is part of MediaWiki.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
23 namespace MediaWiki\Revision
;
25 use MediaWiki\Linker\LinkTarget
;
28 * A SlotRoleHandler for providing basic functionality for undefined slot roles.
30 * This class is intended to be used when encountering slots with a role that used to be defined
31 * by an extension, but no longer is backed by hany specific handler, since the extension in
32 * question has been uninstalled. It may also be used for pages imported from another wiki.
36 class FallbackSlotRoleHandler
extends SlotRoleHandler
{
38 public function __construct( $role ) {
39 // treat unknown content as plain text
40 parent
::__construct( $role, CONTENT_MODEL_TEXT
);
44 * @param LinkTarget $page
46 * @return bool Always false, to prevent undefined slots from being used in new revisions.
48 public function isAllowedOn( LinkTarget
$page ) {
53 * @param string $model
54 * @param LinkTarget $page
56 * @return bool Always false, to prevent undefined slots from being used for
59 public function isAllowedModel( $model, LinkTarget
$page ) {
63 public function getOutputLayoutHints() {
64 // TODO: should be return [ 'display' => 'none'] here, causing undefined slots
65 // to be hidden? We'd still need some place to surface the content of such
66 // slots, see T209923.
68 return parent
::getOutputLayoutHints(); // TODO: Change the autogenerated stub