Jump to content

ProcessWire Dev Branch


ryan

Recommended Posts

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?

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

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"?

post-399-0-26898400-1415530202_thumb.jpg

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

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 :)

  • Like 3
Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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

:)

  • Like 2
Link to comment
Share on other sites

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 :).

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

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 by kongondo
  • Like 3
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...