Completed
Push — master ( 86c16b...d765f6 )
by Robbie
7s
created

CWPPageExtension::updateSearchResults()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 6
c 0
b 0
f 0
nc 4
nop 2
dl 0
loc 12
rs 9.4285
1
<?php
2
3
namespace CWP\AgencyExtensions\Extensions;
4
5
use SilverStripe\Core\Extension;
6
use SilverStripe\SiteConfig\SiteConfig;
7
8
/**
9
 * Class CWPPageExtension
10
 *
11
 * @property Page_Controller $owner
12
 */
13
class CWPPageExtension extends Extension
14
{
15
    /**
16
     * See BasePage_Controller::results()
17
     *
18
     * @param CwpSearchResult $results
19
     * @param array $properties
20
     */
21
    public function updateSearchResults(&$results, &$properties)
22
    {
23
        // Customise empty results
24
        $customNoSearchResultsText = SiteConfig::current_site_config()->NoSearchResults;
25
        if ($customNoSearchResultsText) {
26
            $properties['NoSearchResults'] = $customNoSearchResultsText;
27
        }
28
29
        // Customise empty search
30
        $customEmptyText = SiteConfig::current_site_config()->EmptySearch;
31
        if ($customEmptyText) {
32
            $properties['EmptySearch'] = $customEmptyText;
33
        }
34
    }
35
}
36