Jump to content

Search the Community

Showing results for tags 'extend page class'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. There is excellent article here https://processwire.com/docs/tutorials/using-custom-page-types-in-processwire/ by @LostKobrakai that describes how to use custom page types and extend the Page class. Q: How to extend (e.g. w/o hooks, using method described in article) core Users and User classes and reload $users and $user api variables (they are locked) with new/extended classes? Currently I think about changing User to MyUser class in systems tab (e.g. set another class to be used for 'user' template) and installing module like below. As you can see it adds $myusers and $myuser api variables but I'm not sure that it won't conflict with core. // MyUsers.php class MyUsers extends Users { public function __construct(ProcessWire $wire, $templates = array(), $parents = array()) { parent::__construct($wire, $templates, $parents); $this->setPageClass('MyUser'); } // my non-overlapping methods here ... } // MyUser.php class MyUser extends User { // my non-overlapping methods here ... } class ResourceUser extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'Extend Users and User', 'version' => 100, 'autoload' => true, 'singular' => true, ]; } public function __construct() { require_once(dirname(__FILE__) . '/MyUsers.php'); require_once(dirname(__FILE__) . '/MyUser.php'); } public function init() { $pagesType = new MyUsers($this->wire); $this->wire('myusers', $pagesType, true); $page = new MyUser; $this->wire('myuser', $page, true); } }
×
×
  • Create New...