SilverStripe: make a piece of HTML optional in page -
i not sure how , cant find example on silverstripe site.
i want make checkbox in cms field list. when checked page display code block have. when not checked not.
in page.ss have like:
<% if $showprintbutton %> $showprintbutton <% end_if %>
here relevant code
private static $db = [ 'showprintbutton' => 'boolean(1)' ]; private static $defaults = [ 'showprintbutton' => true ]; public function getcmsfields() { ... $fields->addfieldtotab('root.main', checkboxfield::create('showprintbutton', 'allow printing page')); ... }
Comments
Post a Comment