Skip to content

Instantly share code, notes, and snippets.

@kylejohnson
Created September 25, 2013 01:58
Show Gist options
  • Select an option

  • Save kylejohnson/6694219 to your computer and use it in GitHub Desktop.

Select an option

Save kylejohnson/6694219 to your computer and use it in GitHub Desktop.
<?
App::uses('AppHelper', 'Viwe/Helper');
class BootstrapHelper extends AppHelper {
public $helpers = array('Form');
public function makeInputWithHelp($fieldName, $options = array(), $helpText) {
$input = $this->Form->input($fieldName, $options);
return $input . '<span class="help-block">' . $helpText . '</span>';
}
}
?>
<?php echo $this->Bootstrap->makeInputWithHelp('Name', null, 'I love lamp.'); ?>
<div class="form-group">
<label class="control-label" for="MonitorName">Name</label>
<div class="input text">
<input type="text" id="MonitorName" value="Shed" maxlength="64" class="form-control" name="data[Monitor][Name]">
</div>
<span class="help-block">I love lamp.</span>
</div>
<div class="form-group">
<label class="control-label" for="MonitorName">Name</label>
<div class="input text">
<input type="text" id="MonitorName" value="Shed" maxlength="64" class="form-control" name="data[Monitor][Name]">
</div>
</div>
<span class="help-block">I love lamp.</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment