cultuurnet/culturefeed — pull request #9 by pfrenssen (2013-08-07 16:19:11+00:00)
Title: Retrieve search facets and results from the CultureFeedSearchPage object rather than passing them using globals

The search facets and search results are currently passed to blocks by using a set of global variables:

```
global $culturefeedFacetingComponent;
global $culturefeedSearchResult;
```

Apart from the obvious drawbacks in using global variables this assumes that the page callback runs before the blocks are created. In my case I am overriding the search results page using Panels and my blocks are rendered first. The globals have not yet been set, and my blocks do not work.

Since this data already exists in the CultureFeedSearchPage object it seems logical to me that the blocks should also retrieve it from there, instead of relying on the globals.

I've added a few functions to allow to retrieve the facets and search results from the procedural side. This assumes that only one search for each type has been executed (same end result as with the globals).

The loadPage() method was doing two things:
* Initializing the search parameters.
* Rendering the page.

I split this up into two separate methods, so either the blocks or the page callback can initiate the search, regardless of which runs first.