XF 2.1 Best way to develop

digitalpoint

Well-known member
I figured I'd ask just in case there's something I'm missing...

I'm using PhpStorm for PHP and JavaScript, and just using the normal admin template editor for templates. But I've been finding myself spending more time digging through code to figure out how to do things than I am actually coding stuff.

Are there notes for things that are deprecated somewhere? Like the JavaScript XF.Click handler system was deprecated in 2.1 (I think), and replaced with XF.Event. Not a big deal... easy enough to change, but annoying I've been building stuff in 2.1 with XF.Click because I didn't know it was deprecated. Are deprecated things noted anywhere?

Are there docs for template <xf:??> tags anywhere? I spent way too much time trying to figure out how to pass something to <xf:option>, but render it outside the <label> tags. It turns out it's possible with the afterhtml attribute, but only figured that out after digging through a lot of Template PHP code. Then I spent too much time trying to figure out how to pass HTML to an attribute... then later found the <xf:afterhtml> tags which would have been nice to know. Even just a list of tags and possible attributes somewhere?

Maybe there isn't any detailed documentation like that, but I figured I'd ask in case I'm just making things harder on myself... :)

2.1 is so much fun to develop in because it's so flexible, but learning it all by digging through XF's source code has been time consuming.
 
I'm using PhpStorm for PHP and JavaScript, and just using the normal admin template editor for templates. But I've been finding myself spending more time digging through code to figure out how to do things than I am actually coding stuff.
It’s possible to edit templates on the file system which is considerably easier than the admin editor. You have to enable development mode and that then gives you access to a number of additional CLI commands in the xf-dev namespace. It outputs JSON files and metadata for other content types too (though these aren’t editable on the file system).

As Paul notes, most of that should be covered in the documentation.

Are there notes for things that are deprecated somewhere? Like the JavaScript XF.Click handler system was deprecated in 2.1 (I think), and replaced with XF.Event. Not a big deal... easy enough to change, but annoying I've been building stuff in 2.1 with XF.Click because I didn't know it was deprecated. Are deprecated things noted anywhere?
I don’t think we’ve consciously deprecated it, as such. I don’t think we have any plans to remove it, at least.

I don’t think you will come across much (if anything) that is actually deprecated, aside from a few PHP methods but they’ll be marked as deprecated with phpDoc blocks.
 
I don’t think we’ve consciously deprecated it, as such. I don’t think we have any plans to remove it, at least.
I only noticed it when I was trying to figure something out with XF.Click (because back to the original issue if not much docs that I know about), so I was grepping source code for instances of it to dig through existing code to figure stuff out and noticed only my js files had it now. So then went digging in core.js and saw:

JavaScript:
    // ################################## CLICK HANDLER SYSTEM ###########################################

    /**
     * @deprecated This will be retired in a future version, use XF.Event instead.
     */
    XF.Click = (function()

Not a huge deal in itself... easy enough to update my code, just was curious if there was some place to see what has been deprecated without grepping through stuff and stumbling on it. :)

I don’t think you will come across much (if anything) that is actually deprecated, aside from a few PHP methods but they’ll be marked as deprecated with phpDoc blocks.
It's marked as deprecated in the source. Again, not a big deal in itself, was just seeing if there was a central place for things like deprecations or whatever when major versions come out.
 
What would be really great is a template editor that auto-completes sort of like how the regular editor auto-completes when you tag a username with @... auto-complete from a list that starts when you type <xf:. Also the ability to auto-complete valid attributes would be amazing too. :)

Thank you Baby Jesus, amen.
 
Back
Top Bottom