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

CWPPageExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 20
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateSearchResults() 0 12 3
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