Radio buttons to display one of two titles in view

Permalink
I'm trying to make a block with a static header title and a textarea. The header title will be a choice between two, Header A and Header B. Radio buttons, just pick one to display after you add the block.

I've searched the forums and found a couple of examples but they just didn't work for me. Am I correct that it's a communication between the add/edit.php and controller.php? I have this for controller.php but I don't know what I should be writing for add/edit:

public function getWhichHeader() {
if (?) {
   $title .= "Header A";
} else {
   $title .= "Header B";
}
}


Sorry for being really clueless about this. Any guidance at all is very much appreciated in advance. Thanks.

 
mssteph replied on at Permalink Reply
Okay so I found something different.

db.xml:

<field name="header" type="I1">
<unsigned />
<notnull />
<default value="0" />
</field>


controller.php:

public function save($args) {
      $args['header'] = isset($args['header']) ? 1 : 0;
      parent::save($args);
   }


form.php (add/edit):

<?php
echo $form->checkbox('header', '1', $header);
?>


It's a checkbox, not a radio button like I intended, but it was a found script. The checked box's status is saved, but I can't figure out how to get any saved data, based on the saved check box, to show in view.php. Does anyone have any guidance or suggestions? Thank you so much.
mssteph replied on at Permalink Reply
Nevermind, I found the Designer Content add on and it's super helpful!