InputfieldPageTitle
Single-line text input for page title values
It extends InputfieldText and
inherits text-input behavior such as maxlength, placeholder, pattern,
required, showCount, multi-language support, rendering, and processing.
Its main purpose is the bundled JavaScript that helps auto-populate a page-name input from the title while creating pages.
$f = $modules->get('InputfieldPageTitle');
$f->name = 'title';
$f->label = 'Title';
$form->add($f); For the inherited text-input API, see InputfieldText. For the target page name input, see InputfieldPageName.
| Property | Type | Default | Description |
|---|---|---|---|
nameField | string | '' | Custom-mode target input name. Empty means use default page-add behavior. |
nameDelimiter | string | '' | Custom-mode word delimiter, commonly '-' or '_'. |
nameReplacements | array | [] | Custom-mode character replacement map. Empty falls back to page-name replacements. |
These properties are used only in custom mode, when nameField is non-empty.
On the normal ProcessWire page-add screen, the title input cooperates with the standard InputfieldPageName input. As the user types a title, the raw title is copied to the page-name field and the page-name field handles sanitization.
Once the user edits the page-name field manually, automatic updates stop so the manual page name is preserved.
This mode requires no configuration.
Set nameField to target a non-standard name input:
$f = $modules->get('InputfieldPageTitle');
$f->name = 'title';
$f->nameField = 'custom_name';
$f->nameDelimiter = '-';
$f->nameReplacements = [
'ä' => 'ae',
'ö' => 'oe',
'ü' => 'ue',
'ß' => 'ss',
]; When renderReady() runs, custom mode:
- Adds wrapper class
Inputfield.Page TitleCustom - Adds
data-name-fieldanddata-name-delimiterwrapper attributes. - Publishes
Inputfieldto JavaScript config.Page Title.replacements
The JavaScript then converts title text into the target input value. With a delimiter and strict generation, ASCII letters are lowercased, repeated delimiters are collapsed, and trailing delimiters are trimmed.
Custom mode skips setup in the browser when the target input already has a value, so existing names are not overwritten.
If nameReplacements is empty, custom mode falls back to:
- The
InputfieldPageNamemodulereplacementsconfiguration. InputfieldPageName::getDefaultReplacements().
This keeps custom title-to-name behavior aligned with the site's page-name replacement rules.
- Get an instance with
$modules->get('Inputfield.Page Title') - It is a permanent core module.
- This class adds no server-side title validation beyond InputfieldText.
renderReady()performs custom setup only whennameFieldis populated.- The bundled JavaScript depends on jQuery and is intended for forms that include the matching page-name input.
- Source file:
wire/modules/Inputfield/Inputfield.Page Title/Inputfield Page Title.module
Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Inputfield class also inherits all the methods and properties of: InputfieldText, Inputfield, WireData and Wire.
Common
Properties
| Name | Return | Summary | |
|---|---|---|---|
| Inputfield | string | ||
| Inputfield | string | ||
| Inputfield | array |
Additional methods and properties
In addition to the methods and properties above, Inputfield
API reference based on ProcessWire core version 3.0.268