'Page Name', 'version' => 104, 'summary' => 'Text input validated as a ProcessWire Page name field', 'permanent' => true, ); } public static $defaultReplacements = array( 'å' => 'a', 'ä' => 'a', 'ö' => 'o', 'ü' => 'u', 'đ' => 'dj', 'ж' => 'zh', 'х' => 'kh', 'ц' => 'tc', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shch', 'ю' => 'iu', 'я' => 'ia', ':' => '-', ',' => '-', 'à' => 'a', 'á' => 'a', 'â' => 'a', 'è' => 'e', 'é' => 'e', 'ë' => 'e', 'ê' => 'e', 'ě' => 'e', 'ì' => 'i', 'í' => 'i', 'ï' => 'i', 'î' => 'i', 'õ' => 'o', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ů' => 'u', 'ñ' => 'n', 'ç' => 'c', 'č' => 'c', 'ć' => 'c', 'ď' => 'd', 'ĺ' => 'l', 'ľ' => 'l', 'ń' => 'n', 'ň' => 'n', 'ŕ' => 'r', 'ř' => 'r', 'š' => 's', 'ť' => 't', 'ý' => 'y', 'ž' => 'z', 'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'e', 'з' => 'z', 'и' => 'i', 'й' => 'i', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'ы' => 'y', 'э' => 'e', 'ę' => 'e', 'ą' => 'a', 'ś' => 's', 'ł' => 'l', 'ż' => 'z', 'ź' => 'z', ); public function init() { parent::init(); $this->label = $this->_('Name'); // Field label for 'Name' $this->set('parentPage', null); $this->set('sanitizeMethod', 'pageName'); $this->set('languageSupportLabel', ''); $this->set('slashUrls', 1); // whether a trailing slash should be shown in the URL preview // optional checkbox associated with the input, for use with language support $this->set('checkboxName', ''); // leave blank to disable $this->set('checkboxLabel', ''); $this->set('checkboxValue', ''); $this->set('checkboxChecked', false); $this->description = $this->_("Any combination of letters (a-z), numbers (0-9), dashes or underscores (no spaces)."); // Field description describing what characters are allowed } public function ___render() { $hasLanguagePageNames = $this->wire('modules')->isInstalled('LanguageSupportPageNames'); $url = ''; $out = ''; $box = ''; $user = $this->wire('user'); if($this->parentPage) { $url = $this->parentPage->path; if($hasLanguagePageNames && $this->parentPage->id == $this->wire('config')->rootPageID) { if($user->language->isDefault()) { $parentName = $this->parentPage->name; if(!trim($url, '/') && $parentName) $url = "/$parentName"; } } } if($this->languageSupportLabel) { if($this->checkboxName) { $checked = $this->checkboxChecked ? " checked='checked'" : ''; $name = wire('sanitizer')->entities($this->checkboxName); $value = wire('sanitizer')->entities($this->checkboxValue); $label = wire('sanitizer')->entities($this->checkboxLabel); $box = ""; } $label = wire('sanitizer')->entities($this->languageSupportLabel); $id = wire('sanitizer')->entities($this->attr('id')); $out .= "
"; if($link) $p .= $link; $p .= rtrim($url, '/') . "/"; if($link) $p .= "
"; $p .= ""; $out .= $p; $out .= parent::___render(); if($this->languageSupportLabel) $out .= $box . "