Jump to content

Publish Pages per Language


BitPoet
 Share

Recommended Posts

Here's my first serious attempt at a PW module. I have the need that pages shouldn't be "published" in all languages at once, so I've put together a PageLangPublish module.

It adds both buttons for publishing/unpublishing of each language to the page tree and status icons (from image fields added to each page in admin/languages) next to the page title in the tree.

You can find the module at github under https://github.com/BitPoet/PageLangPublish

I've probably done a lot of things quite awkwardly (even incorrectly) there, so I'd be grateful for any pointers and ideas.

The module also adds a hookable isLanguageViewable method to the Page class. Usage example:

    $topnav = array();
    foreach($homepage->children as $item) {
        if( $item->isLanguageViewable($user->language) )
        {
            $topnav[] = "<a class='topnav' href='{$item->url}'>{$item->title}</a>";
        }
    }
    echo implode(" | ",  $topnav);

Here's a screenshot:

PageLangPublish_screenshot.jpg

  • Like 5
Link to comment
Share on other sites

  • 1 year later...

This looks cool and I have this need in just about every site I make.

But I find it strange that this post is a year old and module isn't listed on the modules directory. Does that mean there are other modules / approaches to this problem?

EDIT: Looks like I've jumped the gun there. Just seen it's in alpha stage on github. Bummer, alpha is scary for client work.

Link to comment
Share on other sites

I've been tweaking this a bit to work in sync with active/inactive statuses, added reasonable default behaviors for trying to access pages in non-viewable languages and made ui interaction a bit smoother, so the code has grown quite a bit. I still need to tidy it up a bit, adapt the installer/uninstall methods, add comments to the code and such and do some testing with the latest PW versions. Once I've found the time for that, it shouldn't be long until I can release a production-ready version, which should be towards the end of January.

  • Like 1
Link to comment
Share on other sites

Sounds great BitPoet. Looking forward to the updates.

IMO this feature is essential for multi language sites, and I'm sure I'll be using in basically every project I make. It's weird that this didn't generate more response from the forum.

Please update this thread when you release a new version.

Link to comment
Share on other sites

  • 9 months later...

It's actually still on the list, but there were a lot of other things that took priority. While I did incorporate some of the changes mentioned above, I'm currently not happy with the behavior in the page list, so this needs some extensive and careful tinkering. Currently, changing online/offline status from the page list reloads the tree each time, which is too time consuming. Since it's in use in production in an ever-growing intranet page, that will become urgent sooner or later, so chances are high I can fit the overhaul in before Christmas.

  • Like 2
Link to comment
Share on other sites

On 1/4/2016 at 4:07 AM, heldercervantes said:

It's weird that this didn't generate more response from the forum.

Indeed strange. To me this is a must-have when dealing with multi language sites. Right now there is not really a way to overview all languages from the PageTree.

4 hours ago, BitPoet said:

I can fit the overhaul in before Christmas

Great! In case you need any testing please let me know.

  • Like 1
Link to comment
Share on other sites

3 minutes ago, tpr said:

How you managed to put the flags on the pagelist - have you arbitrarily choose the flags? I guess this is something one should take care of (eg. via an extra image field).

The module adds two image fields to the language template, one for published and one for unpublished status.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

I'm still in the middle of an almost complete rewrite. I still plan to have it finished by Christmas, but I don't dare to give a more precise estimate right now. As soon as that's finished, I'll release it as a beta and do some heavy-load testing in our intranet to confirm its stability.

  • Like 3
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
 Share

×
×
  • Create New...