MediaWiki master
NewSectionMissingSubjectConstraint.php
Go to the documentation of this file.
1<?php
8
11
20
21 public function __construct(
22 private readonly string $section,
23 private readonly string $subject,
24 private readonly bool $allowBlankSubject,
25 private readonly string $submitButtonLabel,
26 ) {
27 }
28
29 public function checkConstraint(): EditPageStatus {
30 if ( $this->section === 'new' &&
31 !$this->allowBlankSubject &&
32 trim( $this->subject ) === ''
33 ) {
34 return EditPageStatus::newGood( self::AS_SUMMARY_NEEDED )
35 ->setOK( false )
36 ->warning(
37 'missingcommentheader',
38 MessageValue::new( $this->submitButtonLabel )
39 );
40 }
41
43 }
44
45}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:69
For a new section, do not allow the user to post with an empty subject (section title) unless they ch...
__construct(private readonly string $section, private readonly string $subject, private readonly bool $allowBlankSubject, private readonly string $submitButtonLabel,)
Status returned by edit constraints and other page editing checks.
setOK( $ok)
Change operation status.
static newGood( $value=null)
Factory function for good results.
Value object representing a message for i18n.
Interface for all constraints that can prevent edits.