Jump to content
teppo

Version Control

Recommended Posts

@Teppo,

here's the error;

i think this only happens on pages that actually have history for some fields; there is a page where we can add pages to this field, and i think possibly the only difference is that there is no history for any fields on that page

http://mysite.com/manage/page/edit/    Error:     Exception: Can't save field from page 1951: /catalogue/name-of-album-changed/: Call $page->setOutputFormatting(false) before getting/setting values that will be modified and saved.  [album_reviews] (in /home/someaccount/int/wire/core/Pages.php line 1110)  

#0 [internal function]: Pages->___saveField(Object(Page), 'album_reviews', Array)
#1 /home/someaccount/int/wire/core/Wire.php(389): call_user_func_array(Array, Array)
#2 /home/someaccount/int/wire/core/Wire.php(344): Wire->runHooks('saveField', Array)
#3 /home/someaccount/int/wire/core/Page.php(1180): Wire->__call('saveField', Array)
#4 /home/someaccount/int/wire/core/Page.php(1180): Pages->saveField(Object(Page), 'album_reviews', Array)
#5 /home/someaccount/int/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTableAjax.php(110): Page->save('album_reviews')
#6 /home/someaccount/int/wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTableAjax.php(64): InputfieldPageTableAjax->addItem(Object(Page), Object(Field), Object(Page)) #7 [internal function]: Inputf

Share this post


Link to post
Share on other sites

great little module @teppo!

feature suggestions:

1. revision drafting/editing

I would absolutely love a way to create a draft for a new revision to be published in the future. Basically a way to create an unpublished revision of the document with ability to go in and work on it before pushing it live.

2. revision scheduling

And a "draft" revision scheduling would be the next on wishlist.

perhaps there is something already available to enable this without too much effort?

Share this post


Link to post
Share on other sites

great little module @teppo!

Thanks! :)

feature suggestions:

1. revision drafting/editing

I would absolutely love a way to create a draft for a new revision to be published in the future. Basically a way to create an unpublished revision of the document with ability to go in and work on it before pushing it live.

2. revision scheduling

And a "draft" revision scheduling would be the next on wishlist.

perhaps there is something already available to enable this without too much effort?

To be honest this seems to be out of the scope of this module. I've been going over your suggestions a few times in my head, and while I think I could probably implement something like that to this module if I really wanted, I don't really think it's a good idea. Drafts would most likely be easier to implement using a completely different approach.

Ryan took some steps towards drafts support a while ago, so you might want to see where that goes. If Ryan implements that as a core module, I've no interest in trying to duplicate similar behaviour here. Though I haven't used any of those that much, there's also Process Preview by Nico, Page Draft Creator by Rob, and Process Page Drafts by Jan Romero; you could always give one of these a try.

Share this post


Link to post
Share on other sites

I have two issues on my installlation running PW 2.5.20:

The first is regarding the history tab: Method Page::snapshot does not exist or is not callable in this context. It seems that Page Snapshot is not being installed. Uninstalling and re-installing the module doesn't seem to help.

Also, it seems that if I create a new field (CKEditor in this case), assign it to a template, fill it with data, and then assign it to version control, it doesn't track anything. However, after re-installing the module, it worked... I may have missed something, but somewhere, somehow, the process didn't seem right.

Share this post


Link to post
Share on other sites

@Mike: Just gave this a try, and I can't seem to reproduce either issue.

At what point exactly does the "Method Page::snapshot ..." error appear? When you load the page, when you hit preview, when you try to restore earlier revision, or somewhere else? Do you see any additional details, line numbers, etc.?

So far I'm thinking that it might be some weird compatibility issue (PHP, other modules, something) or perhaps a problem with autoload order -- though I might be totally off the track here too. Would be much easier to debug if I could somehow reproduce this :)

Another issue seems to be out of my reach too. Same workflow works for me as expected. In fact, I'm having trouble understanding how this could even happen in the first place -- if the field is enabled via Version Control module settings and other enabled fields are working as expected, this sounds really weird. If you can reproduce this, could you check that module config is actually saved to database?

Other factors that come to mind are some sort of (opcode) caching, and perhaps some installation weirdness related to either the native GUI install/update tool or modules manager. Absolutely not trying to pass the blame, but from what I've heard, both of these have had some issues. Never really used either one myself, which might or might not be the reason I've never had any installation issues either.. :)

Share this post


Link to post
Share on other sites

The error appears when I view the snapshot in the history tab.

I'm going to give this a try on a fresh dev-install tomorrow. I tried it on a dev site (with pretty much no modules installed, and no ModulesManager), and had the issues.

Will also check the config-saving. I'm sure it did though, because the module page updates, and keeps my settings after a refresh.

Share this post


Link to post
Share on other sites

I have problems with VersionControl. We use VersionControl for Textfields which conflicts with VersionControl, well actually with PageSnapShot.

VersionControl is not installed, but PageSnapShot still seems to be active. When I try to delete PageSnapShot I get a Server Error, when I try to delete VersionControl I get an error that VersionControl could not be deleted. When I refresh modules I get 

  •  Failed module dependency: PageSnapshot requires VersionControl

So I am somehow in a trap. Is it possible to remove VersionControl and PageSnapShot manually?

your help ids much appreciated.

Share this post


Link to post
Share on other sites

You can delete any module manually - just use something like PHPMyAdmin and browse/search the "modules" database table and remove the row for the module. Then remove the module folder from the server and you should be good. In the case of this module, there are also some additional db tables to remove, prefixed with "version_control", but be careful to remove the ones for the version of version control that you want to remove.

Also, note that Version Control supersedes Version Control for Textfields. The latter is only still around for older versions of PW.

  • Like 4

Share this post


Link to post
Share on other sites

Hi Adrian

will do so thanks. The thing is we use VersionControl for Textfield in an extended manner. Guess we will have to change that in due time.

Thanks a lot.

Share this post


Link to post
Share on other sites

@bbeer: additionally, if you're using the latest version of Version Control for Text Fields, there's an option in the module settings to *not* remove it's database tables when the module is uninstalled. The purpose of this is to make transition to Version Control easier: it should be able to import old data from Version Control for Text Fields during installation.

I've only done limited amount of tests with this feature, though, so I can't 100% guarantee that it will work. It has worked for me so far, but making backup copies of the module's tables might make sense if you're going to try it.

  • Like 3

Share this post


Link to post
Share on other sites

Would it be possible to add FieldtypeOptions to the supported fields? Currently it's not working.

P.S. Maybe the preview shouldn't close on clicking. It's throwing an error for me, but with SystemNotifications installed one can't look at the whole error message, because the click on the number closes the preview.

Share this post


Link to post
Share on other sites

Would it be possible to add FieldtypeOptions to the supported fields? Currently it's not working.

Added. You can add fields there locally via module settings too.

P.S. Maybe the preview shouldn't close on clicking. It's throwing an error for me, but with SystemNotifications installed one can't look at the whole error message, because the click on the number closes the preview.

I'll have to think about this a bit more. Current behaviour (closing on click) is intentional, partly to prevent weird things happening when something on the previewed page is clicked, can't remember if there were other reasons too. I'm getting some errors also; I'll take a closer look at those first :)

Edit: forget that last part. Errors were a result of local changes, the feature is working as expected again. @LostKobrakai, any chance you could tell more about the error(s) you were getting?

Either way, the click-to-close thing is something I'll take into consideration, but changing this just to make system notifications work doesn't seem reasonable. Displaying admin views in preview mode is something that shouldn't ever happen, after all :)

Edited by teppo

Share this post


Link to post
Share on other sites

I decided to not use version control for this project as this happened in the try out phase. Renobird's ActivityLog was a light alternative in this case. Therefore I can't follow up on your concerns before I'm a little bit less busy. 

Share this post


Link to post
Share on other sites

Some parts of this module, mainly those related to the cleanup features and settings, have been completely rewritten recently. I've also removed some old hacks, mainly from the UI side, that were carried over from Version Control for Text Fields. Test suite has been updated accordingly, and so far I've been unable to find any further issues, at least in the core features of this module.

While some todo items still remain, I've just bumped the version number of the module to 1.0.0, and removed the "beta" status from the modules directory and from the first post in this thread. 1.0.0 should be considered the first stable release of this module, but of course if anyone spots any issues, I'd be more than happy to hear about them, either here or via GitHub.

Big thanks to anyone who's been using this module, reporting issues, etc.!

  • Like 3

Share this post


Link to post
Share on other sites

 I'm looking for a way to move all the version control data from one page to another.

use case:

pageA= a draft page

pageB= source draft was cloned from

pageB need to replace pageA at some point but it has a shallow history.

pageA has a long and wonderful page history, but its going to get replaced by pageB and will lose it all. OH NO! (pageA will be deleted)

Trying to make a function that can copy the history from one page to another, got stuck on how to write the SQL. Wondering if you can give any tips.

 
 
  private function moveRevisionHistory($sourcePageId, $destinationPageId)
    {
        $database = $this->wire('database');
        $this->message("UPDATE version_control__revisions SET pages_id=$sourcePageId WHERE pages_id=$destinationPageId");
        $query = $database->prepare("UPDATE version_control__revisions SET pages_id=$sourcePageId WHERE pages_id=$destinationPageId");
        $query->execute();
        $query->closeCursor();
    }

This just changing the pages_id seems to break things, any tips on what else I need to update to move a page? there are a hand full of id's spanning across a few tables not sure what other id fields are storing "pages_id" information that would need to be updated. Maybe I have to update the parent field as well?

Update: Simplified way talking about it.

I am trying to move a history from one page to another page.

I am updating the pages_id, but that does not seem to do it. Do I also need to update the "parent" field some how?

Example SQL:

UPDATE version_control__revisions SET pages_id=$new_page_id_of_page_with_same_template WHERE pages_id=$page_id_to_update ;

Share this post


Link to post
Share on other sites

@Neeks: that sounds pretty much right; revisions table is the only one containing references to page ID, so changing it there should be enough. I can't think of anything else you'd need to do straight away, though I haven't attempted anything like that before either, so it's entirely possible that something isn't working quite right after this (like you've mentioned above).

Could you explain what exactly breaks after this? I might be able to help you if I knew what went wrong. Currently I'm busy with other stuff, and can't really set up a test case for this myself.

Share this post


Link to post
Share on other sites

@Teppo, thanks for confirming that is how it should work...I stepped away from my code and tried it with straight SQL and with hard coded page ID's and it worked. I did try this earlier, but I must have been working with not enough sleep (I was on the wrong server writing SQL and watching for results in the admin of another...sigh...)

Share this post


Link to post
Share on other sites

I've just tried this out using 3.0.20 and have some observations. In the setup I selected one template and several fields but left defaults for everything else. I did not select any image or file fields.

It created tables, including one in which I found information about images.

In the edit page for the template I enabled in setup just about every field has little clock icon on it, many of them no selected in setup.

edit: Many of these don't have any changes yet but still show an icon (distracting for users)

The fields I did select seem to work as intended and the others do not record changes, they just have the icons.

Any ideas about how to record changes made to a PageTableExtended field (pages saved as children, different template)?

Another question, when it installed and populated tables I wondered if that process is timeout proof (batching of some kind to handle thousands of pages).

Thanks.

Share this post


Link to post
Share on other sites

Hey @teppo, just tried the module on 2.8 and i get the error Argument 1 passed to VersionControl::isEnabledTemplate() must be an instance of Template on line 897, you have any idea of why that might be?

  • Like 1

Share this post


Link to post
Share on other sites

Just for info. The error diego reported is also in 3.x now. (Wasn't there until the last PW3 update)

Share this post


Link to post
Share on other sites
On 20.06.2016 at 5:36 PM, diogo said:

Hey @teppo, just tried the module on 2.8 and i get the error Argument 1 passed to VersionControl::isEnabledTemplate() must be an instance of Template on line 897, you have any idea of why that might be?

Got the same error on PW 3.0.25

Share this post


Link to post
Share on other sites

The issue mentioned above was related to a recent change in the core class InputfieldWrapper. I've just created an issue for this to the ProcessWire repository in GitHub (https://github.com/ryancramerdesign/ProcessWire/issues/1936) and updated VersionControl to circumvent this issue. If you update the module to the latest version, it should work again.

Sorry for the inconvenience!

/cc @diogo, @ceberlin, @Zeka

  • Like 5

Share this post


Link to post
Share on other sites

Anybody using this with Spex in their templates? When I click to preview revision in the history tab listings it accesses a url like...

/processwire/setup/version-control/preview/?pages_id=38172&revision=333

That causes...

Fatal error: Call to a member function setLayout() on null in...

Just asking in case it's come up before. Thanks.

 

Share this post


Link to post
Share on other sites

Sorry, I've never actually used Spex myself, but just a quick comment: that URL triggers the executePreview() method of ProcessVersionControl.module, which in turn tries to render the given page in a specific version. It sounds like rendering the page this way is a problem, though I have no idea why. Someone with proper understanding of Spex could probably answer that one :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Robin S
      First a note about my other modules...
      I have three existing modules that are similar in that they allow restrictions to be placed on repeating inputfields: Limit Repeater, Limit PageTable, Limit Table
      Restrict Repeater Matrix takes a different approach to the module configuration from those other modules. The module settings for Restrict Repeater Matrix are applied in the field settings rather in a module config screen. I think this new approach is better, but it means that it isn't practical to create different settings for different roles via the admin interface. Instead the module has a hookable method, allowing roles to be targeted and other advanced usages to be achieved via a hook. The result is that the module is more flexible.
      I intend to transition my other modules to the same approach over the coming weeks, but because this will result in breaking changes I will be releasing the updated modules under new names ("Restrict Repeater", etc) to avoid users upgrading via the Upgrades module without full awareness of the changes. The old modules will be marked as deprecated.
      Restrict Repeater Matrix
      A module for ProcessWire CMS/CMF. Allows restrictions and limits to be placed on Repeater Matrix fields. Requires ProcessWire >= v3.0.0 and FieldtypeRepeaterMatrix >= v0.0.5.
      For any matrix type in a Repeater Matrix field you have the option to:
      Disable settings for items (cannot change matrix type) Prevent drag-sorting of items Prevent cloning of items Prevent toggling of the published state of items Prevent trashing of items Limit the number of items that may be added to the inputfield. When the limit is reached the "Add new" button for the matrix type will be removed and the matrix type will not be available for selection in the "Type" dropdown of other matrix items. Please note that restrictions and limits are applied with CSS/JS so should not be considered tamper-proof.
      Usage
      Install the Restrict Repeater Matrix module.
      For each matrix type created in the Repeater Matrix field settings, a "Restrictions" fieldset is added at the bottom of the matrix type settings:

      For newly added matrix types, the settings must be saved first in order for the Restrictions fieldset to appear. Set restrictions for each matrix type as needed. A limit of zero means that no items of that matrix type may be added to the inputfield.
      Setting restrictions via a hook
      Besides setting restrictions in the field settings, you can also apply or modify restrictions by hookingRestrictRepeaterMatrix::checkRestrictions. This allows for more focused restrictions, for example, applying restrictions depending on the template of the page being edited or depending on the role of the user.
      The checkRestrictions() method receives the following arguments:
      $field This Repeater Matrix field $inputfield This Repeater Matrix inputfield $matrix_types An array of matrix types for this field. Each key is the matrix type name and the value is the matrix type integer. $page The page that is open in ProcessPageEdit The method returns a multi-dimensional array of matrix types and restrictions for each of those types. An example of a returned array:

      Example hooks
      Prevent the matrix type "images_block" from being added to "my_matrix_field" in a page with the "basic-page" template:
      $wire->addHookAfter('RestrictRepeaterMatrix::checkRestrictions', function(HookEvent $event) { $field = $event->arguments('field'); $page = $event->arguments('page'); $type_restrictions = $event->return; if($field->name === 'my_matrix_field' && $page->template->name === 'basic-page') { $type_restrictions['images_block']['limit'] = 0; } $event->return = $type_restrictions; }); Prevent non-superusers from trashing any Repeater Matrix items in "my_matrix_field":
      $wire->addHookAfter('RestrictRepeaterMatrix::checkRestrictions', function(HookEvent $event) { $field = $event->arguments('field'); $type_restrictions = $event->return; if($field->name === 'my_matrix_field' && !$this->user->isSuperuser()) { foreach($type_restrictions as $key => $value) { $type_restrictions[$key]['notrash'] = true; } } $event->return = $type_restrictions; }); http://modules.processwire.com/modules/restrict-repeater-matrix/
      https://github.com/Toutouwai/RestrictRepeaterMatrix
    • By BitPoet
      Here's a little text formatter module that redirects all external links found in a textarea (e.g. for hit counting) to a given URL.
      TextformatterExternalRedirect
      GitHub repo
      As TextFormatters do, this module modifies the contents of the textarea (HTML) at rendering time. It prepends the given URL to the link address for external links (http and https), optionally makes sure that the link is opened in a new window and allows you to add css classes to such links.
      All options can be configured in the module's configuration settings.
      Usage:
      Download the zip archive and extract it to site/modules, the rename the top folder to TextformatterExternalRedirect Go to the backend and select "Modules" -> "Refresh", then click "Install" for "External Link Redirect" Click "Settings" and configure the module
      Go into the field configuration for the field(s) you want this formatter to apply to and add it from the dropdown
      Done, now any external links in the configured fields will have the configured settings applied Feel free to leave feedback and post and questions you have here.
       
    • By teppo
      Hey folks!
      Took a couple of late nights, but managed to turn this old gist of mine into a proper module. The name is SearchEngine, and currently it provides support for indexing page contents (into a hidden textarea field created automatically), and also includes a helper feature ("Finder") for querying said contents. No fancy features like stemming here yet, but something along those lines might be added later if it seems useful (and if I find a decent implementation to integrate).
      Though the API and selector engine make it really easy to create site search pages, I pretty much always end up duplicating the same features from site to site. Also – since it takes a bit of extra time – it's tempting to skip over some accessibility related things, and leave features like text highlighting out. Overall I think it makes sense to bundle all that into a module, which can then be reused over and over again 🙂
      Note: markup generation is not yet built into the module, which is why the examples below use PageArray::render() method to produce a simple list of results. This will be added later on, as a part of the same module or a separate Markup module. There's also no fancy JS API or anything like that (yet).
      This is an early release, so be kind – I got the find feature working last night (or perhaps this morning), and some final tweaks and updates were made just an hour ago 😅
      GitHub repository: https://github.com/teppokoivula/SearchEngine Modules directory: https://modules.processwire.com/modules/search-engine/ Demo: https://wireframe-framework.com/search/ Usage
      Install SearchEngine module. Note: the module will automatically create an index field install time, so be sure to define a custom field (via site config) before installation if you don't want it to be called "search_index". You can change the field name later as well, but you'll have to update the "index_field" option in site config or module settings (in Admin) after renaming it.
      Add the site search index field to templates you want to make searchable. Use selectors to query values in site search index. Note: you can use any operator for your selectors, you will likely find the '=' and '%=' operators most useful here. You can read more about selector operators from ProcessWire's documentation.
      Options
      By default the module will create a search index field called 'search_index' and store values from Page fields title, headline, summary, and body to said index field when a page is saved. You can modify this behaviour (field name and/or indexed page fields) either via the Module config screen in the PocessWire Admin, or by defining $config->SearchEngine array in your site config file or other applicable location:
      $config->SearchEngine = [ 'index_field' => 'search_index', 'indexed_fields' => [ 'title', 'headline', 'summary', 'body', ], 'prefixes' => [ 'link' => 'link:', ], 'find_args' => [ 'limit' => 25, 'sort' => 'sort', 'operator' => '%=', 'query_param' => null, 'selector_extra' => '', ], ]; You can access the search index field just like any other ProcessWire field with selectors:
      if ($q = $sanitizer->selectorValue($input->get->q)) { $results = $pages->find('search_index%=' . $query_string . ', limit=25'); echo $results->render(); echo $results->renderPager(); } Alternatively you can delegate the find operation to the SearchEngine module as well:
      $query = $modules->get('SearchEngine')->find($input->get->q); echo $query->resultsString; // alias for $query->results->render() echo $query->pager; // alias for $query->results->renderPager() Requirements
      ProcessWire >= 3.0.112 PHP >= 7.1.0 Note: later versions of the module may require Composer, or alternatively some additional features may require installing via Composer. This is still under consideration – so far there's nothing here that would really depend on it, but advanced features like stemming most likely would.
      Installing
      It's the usual thing: download or clone the SearchEngine directory into your /site/modules/ directory and install via Admin. Alternatively you can install SearchEngine with Composer by executing composer require teppokoivula/search-engine in your site directory.
    • By teppo
      MarkupMenu is a markup module for generating menu trees. When provided a root page as a starting point, it generates a navigation tree (by default as a HTML "<ul>" element wrapped by a "<nav>" element) from that point onwards. If you've also provided it with current (active) page, the menu will be rendered accordingly, with current item highlighted and items rendered up to that item and its children (unless you disable the "collapsed" option, in which case the full page tree will be rendered instead).
      Modules directory: https://modules.processwire.com/modules/markup-menu/ GitHub repository: https://github.com/teppokoivula/MarkupMenu Usage
      As a markup module, MarkupMenu is intended for front-end use, but you can of course use it in a module as well. Typically you'll only need the render() method, which takes an array of options as its only argument:
      echo $modules->get('MarkupMenu')->render([ 'root_page' => $pages->get(1), 'current_page' => $page, ]); Note: if you omit root_page, site root page is used by default. If you omit current_page, the menu will be rendered, but current (active) page won't be highlighted etc.
      A slightly more complex example, based on what I'm using on one of my own sites to render a (single-level) top menu:
      echo $modules->get('MarkupMenu')->render([ 'current_page' => $page, 'templates' => [ 'nav' => '<nav class="{classes} menu--{menu_class_modifier}" aria-label="{aria_label}">%s</nav>', 'item_current' => '<a class="menu__item menu__item--current" href="{item.url}" tabindex="0" aria-label="Current page: {item.title}">{item.title}</a>', ], 'placeholders' => [ 'menu_class_modifier' => 'top', 'aria_label' => 'Main navigation', ], 'include' => [ 'root_page' => true, ], 'exclude' => [ 'level_greater_than' => 1, ], ]); Note: some things you see above may not be entirely sensible, such as the use of {menu_class_modifier} and {aria_label} placeholders. On the actual site the "nav" template is defined in site config, so I can define just these parts on a case-by-case basis while actual nav markup is maintained in one place.
      Please check out the README file for available render options. I'd very much prefer not to keep this list up to date in multiple places. Basically there are settings for defining "templates" for different parts of the menu (list, item, etc.), include array for defining rules for including in the menu and exclude array for the opposite effect, classes and placeholders arrays for overriding default classes and injecting custom placeholders, etc. 🙂
      MarkupMenu vs. MarkupSimpleNavigation
      TL;DR: this is another take on the same concept. There are many similarities, but also some differences – especially when it comes to the supported options and syntax. If you're currently using MarkupSimpleNavigation then there's probably no reason to switch over.
      I'd be surprised if someone didn't draw lines between this module and Soma's awesome MarkupSimpleNavigation. Simply put I've been using MSN (...) for years, and it's been great – but there are some issues with it, particularly in the markup generation area, and it also does some things in a way that doesn't quite work for me – the xtemplates thing being one of these. In some ways less about features, and more about style, I guess 🙂
      Anyhow, in MarkupMenu I've tried to correct those little hiccups, modernise the default markup, and allow for more flexibility with placeholder variables and additional / different options. MarkupMenu was built for ProcessWire 3.0.112+ and with PHP 7.1+ in mind, it's installable with Composer, and I have a few additional ideas (such as conditional placeholders) still on my todo list.
      One more small(ish) difference is that MarkupMenu supports overriding default options via $config->MarkupMenu. I find myself redefining the default markup for every site, which until now meant that each site had a wrapper function for MarkupSimpleNavigation (to avoid code / config repetition), and this way I've been able to leave that out 🙂
      Requirements
      ProcessWire >= 3.0.112 PHP >= 7.1.0 If you're working on an earlier version of ProcessWire or PHP, use MarkupSimpleNavigation instead.
    • By teppo
      Hey folks!
      I'm happy to finally introduce a project I've been working on for quite a while now: it's called Wireframe, and it is an output framework for ProcessWire.
      Note that I'm posting this in the module development area, maily because this project is still in rather early stage. I've built a couple of sites with it myself, and parts of the codebase have been powering some pretty big and complex sites for many years now, but this should still be considered a soft launch 🙂
      --
      Long story short, Wireframe is a module that provides the "backbone" for building sites (and apps) with ProcessWire using an MVC (or perhaps MVVM – one of those three or four letter abbreviations anyway) inspired methodology. You could say that it's an output strategy, but I prefer the term "output framework" since in my mind the word "strategy" means something less tangible. A way of doing things, rather than a tool that actually does things.
      Wireframe (the module) provides a basic implementation for some familiar MVC concepts, such as Controllers and a View layer – the latter of which consists of layouts, partials, and template-specific views. There's no "model" layer, since in this context ProcessWire is the model. As a module Wireframe is actually quite simple – not even nearly the biggest one I've built – but there's still quite a bit of stuff to "get", so I've put together a demo & documentation site for it at https://wireframe-framework.com/.
      In addition to the core module, I'm also working on a couple of site profiles based on it. My current idea is actually to keep the module very light-weight, and implement most of the "opinionated" stuff in site profiles and/or companion modules. For an example MarkupMenu (which I released a while ago) was developed as one of those "companion modules" when I needed a menu module to use on the site profiles.
      Currently there are two public site profiles based on Wireframe:
      site-wireframe-docs is the demo&docs site mentioned above, just with placeholder content replaced with placeholder content. It's not a particularly complex site, but I believe it's still a pretty nice way to dig into the Wireframe module. site-wireframe-boilerplate is a boilerplate (or starter) site profile based on the docs site. This is still very much a work in progress, but essentially I'm trying to build a flexible yet full-featured starter profile you can just grab and start building upon. There will be a proper build process for resources, it will include most of the basic features one tends to need from site to site, etc. --
      Requirements and getting started:
      Wireframe can be installed just like any ProcessWire module. Just clone or download it to your site/modules/ directory and install. It doesn't, though, do a whole lot of stuff on itself – please check out the documentation site for a step-by-step guide on setting up the directory structure, adding the "bootstrap file", etc. You may find it easier to install one of the site profiles mentioned above, but note that this process involves the use of Composer. In the case of the site profiles you can install ProcessWire as usual and download or clone the site profile directory into your setup, but after that you should run "composer install" to get all the dependencies – including the Wireframe module – in place. Hard requirements for Wireframe are ProcessWire 3.0.112 and PHP 7.1+. The codebase is authored with current PHP versions in mind, and while running it on 7.0 may be possible, anything below that definitely won't work. A feature I added just today to the Wireframe module is that in case ProcessWire has write access to your site/templates/ directory, you can use the module settings screen to create the expected directories automatically. Currently that's all, and the module won't – for an example – create Controllers or layouts for you, so you should check out the site profiles for examples on these. (I'm probably going to include some additional helper features in the near future.)
      --
      This project is loosely based on an earlier project called pw-mvc, i.e. the main concepts (such as Controllers and the View layer) are very similar. That being said, Wireframe is a major upgrade in terms of both functionality and architecture: namespaces and autoloader support are now baked in, the codebase requires PHP 7, Controllers are classes extending \Wireframe\Controller (instead of regular "flat" PHP files), implementation based on a module instead of a collection of drop-in files, etc.
      While Wireframe is indeed still in a relatively early stage (0.3.0 was launched today, in case version numbers matter) for the most part I'm happy with the way it works, and likely won't change it too drastically anytime soon – so feel free to give it a try, and if you do, please let me know how it went. I will continue building upon this project, and I am also constantly working on various side projects, such as the site profiles and a few unannounced helper modules.
      I should probably add that while Wireframe is not hard to use, it is more geared towards those interested in "software development" type methodology. With future updates to the module, the site profiles, and the docs I hope to lower the learning curve, but certain level of "developer focus" will remain. Although of course the optimal outcome would be if I could use this project to lure more folks towards that end of the spectrum... 🙂
      --
      Please let me know what you think – and thanks in advance!
×
×
  • Create New...