Skip to content

Commit

Permalink
feature/customer-flag: Added template global and updated the default …
Browse files Browse the repository at this point in the history
…template, also added return type hints
  • Loading branch information
Dennis Ruiter committed Dec 2, 2022
1 parent 7dff158 commit c6cfd15
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@
namespace WeDevelop\Portfolio;

use SilverStripe\Core\Config\Configurable;
use SilverStripe\View\TemplateGlobalProvider;

class Config
class Config implements TemplateGlobalProvider
{
use Configurable;

public static function isCustomerEnabled()
public static function isCustomerEnabled(): bool
{
return self::config()->get('customer_enabled');
}

public static function get_template_global_variables(): array
{
return [
'WeDevelopPortfolioConfigIsCustomerEnabled' => 'isCustomerEnabled'
];
}
}
2 changes: 1 addition & 1 deletion templates/WeDevelop/Portfolio/Pages/Layout/CasePage.ss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<li>$PublicationDate.Nice</li>
<% end_if %>
</ul>
<% if $Customer %>
<% if $Customer && $WeDevelopPortfolioConfigIsCustomerEnabled %>
<span>$Customer.Title</span><br/>
<% end_if %>
<hr />
Expand Down

0 comments on commit c6cfd15

Please sign in to comment.