pwFoo 289 Posted October 6, 2014 3. Conditional autoload modules. In PHP 5.3+, modules may now specify an anonymous function OR a selector string, rather than a boolean for the 'autoload' property returned by getModuleInfo(). PW runs the anonymous function after determining the current $page, so your module can make autoload decisions based on the $page (or any other factor you'd like), if desired. Lets say that we have a module that we only want to autoload when the template is 'admin': public static function getModuleInfo() { return array( 'title' => 'Module Title', 'summary' => 'Summary text...', 'version' => 1, 'autoload' => function() { if(wire('page')->template == 'admin') return true; else return false; }); } And the same example but using a selector for autoload: public static function getModuleInfo() { return array( 'title' => 'Module Title', 'summary' => 'Summary text...', 'version' => 1, 'autoload' => 'template=admin' ); } Hi Ryan, tried that conditional autoload with a module is loaded check, but doesn't work... 'autoload' => function () { return class_exists('UserFrontendRegister',false); }, Would be a way to auto load a submodule / plugin only if needed Isn't the module loaded during execute that code? How to get it work? Quote Share this post Link to post Share on other sites
nfil 48 Posted October 17, 2014 hi. After upgrading from 2.4.5 to 2.5.3 or .4 I cannot create new fields I always see the msg Field 'name' is required No input fields just the message. reverting the folder wire to 2.4.5 I am able to create the new fields in the backend. Tested with php 5.4.13 and 5.5.0 and checked the few modules installed batcher etc, and they seem to be compatible and the latest version was installed, no info in the error log too. Quote Share this post Link to post Share on other sites
ryan 16,724 Posted October 17, 2014 hi. After upgrading from 2.4.5 to 2.5.3 or .4 I cannot create new fields I always see the msg Field 'name' is required So far I can't duplicate this one. Anyone else able to? @nfil, just to confirm you are talking about Setup > Fields > Add New, and you are entering a field name correct? Because it is true that a field name is required. What modules do you have installed in Modules > Site ? Quote Share this post Link to post Share on other sites
ryan 16,724 Posted October 17, 2014 Would be a way to auto load a submodule / plugin only if needed Isn't the module loaded during execute that code? How to get it work? Whether that will work depends entirely on the load order of the modules. You can affect the load order by making one module require another. However, if the two modules are related, it would be better to simply make the UserFrontendRegister module the only autoload one, and make it call upon the other modules when needed. Conditional autoloads are much better used for things like determining page or template context. Quote Share this post Link to post Share on other sites
nfil 48 Posted October 17, 2014 So far I can't duplicate this one. Anyone else able to? @nfil, just to confirm you are talking about Setup > Fields > Add New, and you are entering a field name correct? Because it is true that a field name is required. What modules do you have installed in Modules > Site ? Hi Ryan, yes the Setup > Fields > Add New fields. Can only see the required name field message and a blank screen underneath it. Tested it on multiple browsers. I have these modules installed, yet I had multi language enabled before, but not at the moment. Map Markup (Google Maps) 1.0.1 Markup Simple Navigation 1.3.3 Markup Sitemap XML 1.0.9 Import Pages from CSV 1.0.4 HiddenAdminPages 1.0.0 Clean Empty Page File Dirs 0.0.3 Batcher 1.0.4 Pages2Pdf 1.1.1 Forms TinyMCE (updated) I will do some more tests this weekend. Thanks. p.s. I also tested the upgrade module and no errors there too, all the modules were updated and compatible. Quote Share this post Link to post Share on other sites
Marty Walker 386 Posted October 28, 2014 Not sure if this has been mentioned or not. If I go to Access > Roles > Add New, type in a name and hit the tab key - I get a duplicate field and Save button. Same story when adding Users. Quote Share this post Link to post Share on other sites
adrian 11,187 Posted October 28, 2014 Hey Marty, I can't seem to reproduce in today's dev version. Did you get Ryan's updates from today with improvements to the new name checker? Did you do a hard reload to update js scripts? Quote Share this post Link to post Share on other sites
Marty Walker 386 Posted October 28, 2014 Hi Adrian, Running 2.5.6 but that was from the other day. Downloaded it again and it looks to be sorted. There goes my chance at bug-fixing glory! 5 Quote Share this post Link to post Share on other sites
pwFoo 289 Posted October 28, 2014 Tried to install TinyMCE, but after click "install" it changed to ckeditor. TinyMCE install link seems broken in dev. Quote Share this post Link to post Share on other sites
adrian 11,187 Posted October 28, 2014 No problem installing TinyMCE here. Did you hit the enter button on your keyboard, rather than clicking the Download and Install button? There was some weird behavior with this until the commits over the weekend. Quote Share this post Link to post Share on other sites
Lars282 23 Posted November 9, 2014 Not sure if this is already reported or intentional: when adding a new page using the latest dev, the result of the check if the entered page name is already taken displays between the field name "Name" and the "*" for mandatory (see screenshot). It seems a bit confusing to have the "*" in a separate line below, maybe this should still be shown after the "Name"? 1 Quote Share this post Link to post Share on other sites
Lars282 23 Posted November 9, 2014 Any chance that the second submit button is not available anymore in the latest dev? Checked the ProcessPageEdit module and believe that in lines 362 to 366 the "field2" should actually be "submit2"? If this is changed, the button is back. Quote Share this post Link to post Share on other sites
renobird 2,043 Posted November 25, 2014 Ryan, The new @ option in selectors saved me today. Just wanted to say thanks. 3 Quote Share this post Link to post Share on other sites
apeisa 3,737 Posted November 25, 2014 It should be default, just saying 1 Quote Share this post Link to post Share on other sites
owzim 602 Posted December 16, 2014 @apeisa, if Ryan would make it default, past sites and modules can/will break. Another matter: does anyone know how many minor iterations are left until 2.6? I'd like to see a stable release soon. Quote Share this post Link to post Share on other sites
teppo 4,638 Posted December 17, 2014 Another matter: does anyone know how many minor iterations are left until 2.6? I'd like to see a stable release soon. Hopefully we won't be going to 2.6 without, at least, merging some things from current dev branch to master (2.5). Just saying. New features are one thing, but there are also bugfixes there, as far as I can remember correctly. IMHO minor versions (x.x) should always be stable and contain no known bugs. Unless support for 2.5 is dropped instantly when 2.6 comes out, which I hope we won't be doing -- upgrading from one minor version to another shouldn't be required just to get bugfixes in 3 Quote Share this post Link to post Share on other sites
pwired 1,250 Posted December 17, 2014 IMHO minor versions (x.x) should always be stable and contain no known bugs. Unless support for 2.5 is dropped instantly when 2.6 comes out, which I hope we won't be doing -- upgrading from one minor version to another shouldn't be required just to get bugfixes in I Fully agree with that. ============================================================= But here is what I see coming: It looks to me that since 2.4 the need for making it shine and show is creeping in. I have no problem with _main.php and delayed output since 2.5 but why putting more bells and whistles in the core ? Processwire is famous because of it's fast and bare bones core, leaving it up to the user to build on top of it. Extending should only be done with modules. Another example: Same thing is happening right now with OpenCart. Until version 1.5.6.4 the core was fast, barbones and came with a back-end that was easy to understand for everyone. Missing functionality can easily be extended with extensions/modules. With the latest release 2.0 things start to shine and show with more whistles and bells with an admin on the brink of becoming confusing. Somehow things can not stay fast, barbones, easy and free to build on for everyone. In the end, stuff that makes it shine, show, bloat, and confusing always creeps in. 2 Quote Share this post Link to post Share on other sites
owzim 602 Posted December 17, 2014 upgrading from one minor version to another shouldn't be required just to get bugfixes in Totally agree, and tell that Apple, those f*#%ers made me update to iOS 7 to fix the SSL bug. Now my iPhone 4 is slow as hell. /rant 2 Quote Share this post Link to post Share on other sites
Ivan Gretsky 1,103 Posted December 18, 2014 Joomla just recently changed their release strategy. I never heard we at PW have one )) I think we're mature enough to think about it. It seems a little strange to just freeze a version not providing any bug fixes in stable branch. Of course, it is strange only if you don't know how many people named Ryan from Atlanta are working on it . Anyway, clear release strategy is a must have to grow and to possibly involve more people in the development/bug fixing. Not sure what comes first though: strategy or more people . 2 Quote Share this post Link to post Share on other sites
ryan 16,724 Posted January 30, 2015 This week's dev branch updates include a new Fieldtype (FieldtypeOptions): https://processwire.com/blog/posts/new-options-fieldtype-processwire-2.5.17/ (blog post about it) and documentation https://processwire.com/api/modules/select-options-fieldtype/ 16 Quote Share this post Link to post Share on other sites
kongondo 6,726 Posted January 31, 2015 (edited) Ryan, you have a MySQL syntax error in SelectableOptionManager.php. This prevents values from being updated. You are missing a 'space' in the sql statement on line #548 the concatenation gets mangled up resulting in this: Option 14 'New York': SQLSTATE[HY093]: Invalid parameter number: parameter was not defined The fix is simple: Change: $sql .= "WHERE fields_id=:fields_id AND option_id=:option_id"; To: $sql .= " WHERE fields_id=:fields_id AND option_id=:option_id"; I see the 'space' on line #543 but I suppose that's only for multi-language environments? I guess I am getting the above error because I am testing on a single language environment. $sql .= ", $name=:$name "; Not sure how the suggested change will affect those in multi-language environments, but am sure you will sort it out Also filed a bug report in GitHub case you miss this. Edited January 31, 2015 by kongondo 3 Quote Share this post Link to post Share on other sites
Pete 3,622 Posted February 1, 2015 Multiple spaces shouldn't be a problem, but no spaces will be. 1 Quote Share this post Link to post Share on other sites
kongondo 6,726 Posted February 1, 2015 Issue fixed in the dev branch - by including a trailing space much earlier.... Quote Share this post Link to post Share on other sites
Marty Walker 386 Posted February 3, 2015 Posting this here as I'm using 2.5.17. If I go to save (I'm not cloning it) a PageTable field I get this error: Unable to clone field because name "" is already in use or is a reserved name. 1 Quote Share this post Link to post Share on other sites
Sephiroth 327 Posted February 3, 2015 Posting this here as I'm using 2.5.17. If I go to save (I'm not cloning it) a PageTable field I get this error: Unable to clone field because name "" is already in use or is a reserved name. Yeah i get that with the option field might look into it Quote Share this post Link to post Share on other sites