public function submit($caption = null, $options = array()) { $defaults = array('class' => 'btn', 'escape' => false); $options = array_merge($defaults, $options); list($caption, $options) = $this->_bootstrapGenerate($caption, $options); return parent::submit($caption, $options); }
public function end($string = 'Salvar', $options = array()) { $optionsDefault = array('class' => 'btn btn-primary', 'div' => 'form-group'); $options = array_merge_recursive($optionsDefault, $options); $retorno = parent::submit($string, $options); $retorno .= parent::end(); return $retorno; }
/** * create tweet box * * @param $fieldName * @param $options * type: element type (default: textarea) * maxLength: text max length (default: 140) * counterText: length message * submit: submit button message. if set to false, not create. * jqueryCharCount: path to charCount.js (jquery plugin) * other keys set to input element options. */ public function tweet($fieldName, $options = array()) { $this->setEntity($fieldName); $domId = !empty($options['id']) ? $options['id'] : $this->domId($fieldName); $default = array('type' => 'textarea', 'maxlength' => 140, 'jqueryCharCount' => '/twitter_kit/js/charCount.js', 'counterText' => __d('twitter_kit', 'Characters left: ', true), 'submit' => __d('twitter_kit', 'Tweet', true)); $options = am($default, $options); $inputOptions = $options; unset($inputOptions['jqueryCharCount']); unset($inputOptions['counterText']); unset($inputOptions['submit']); $out = $this->Html->script($options['jqueryCharCount']); $out .= $this->Form->input($fieldName, $inputOptions); $out .= $this->Js->buffer("\n \$('#{$domId}').charCount({\n limit: {$options['maxlength']},\n counterText: '{$options['counterText']}',\n exceeded: function(element) {\n \$('#{$domId}Submit').attr('disabled', true);\n },\n allowed: function(element) {\n \$('#{$domId}Submit').removeAttr('disabled');\n }\n });\n "); if ($options['submit']) { $out .= $this->Form->submit($options['submit'], array('id' => $domId . 'Submit')); } return $this->output($out); }
public function submit($caption = null, $options = array()) { $defaultOptions = array('class' => 'btn btn-primary', 'div' => 'form-group', 'data-style' => 'expand-right', 'before' => '<div class="col-lg-offset-2 col-lg-10">', 'after' => '</div>'); if (isset($options['bootstrap']) && $options['bootstrap'] == false) { $defaultOptions = array('class' => 'btn btn-primary'); unset($options['bootstrap']); } if (!isset($options['bootstrap'])) { if (isset($options['confirm'])) { $options['onclick'] = 'confirmSubmitForm($(this), \'' . $options['confirm'] . '\'); return false;'; } unset($options['confirm']); } $options = array_merge($defaultOptions, $options); $options['class'] .= ' ladda-button'; return parent::submit($caption, $options); }
public function testSubmit() { $html = $this->object->submit('element', 'value', array('class' => 'test-class-1', 'arbitrary' => 'arbitrary'), 'test-class-2'); $this->assertAttributes($html, array('class' => array('test-class-1', 'test-class-2', 'ccm-input-submit'), 'value' => 'value')); }
public function submit($value = 'Save', $options = array()) { $defaults = array('class' => 'btn btn-primary'); $options = Set::merge($defaults, $options); return parent::submit($value, $options); }
/** * Creates a submit button element. This method will generate `<input />` elements that * can be used to submit, and reset forms by using $options. image submits can be created by supplying an * image path for $caption. * * ### Options * * - `div` - Include a wrapping div? Defaults to true. Accepts sub options similar to * FormHelper::input(). * - `before` - Content to include before the input. * - `after` - Content to include after the input. * - `type` - Set to 'reset' for reset inputs. Defaults to 'submit' * - Other attributes will be assigned to the input element. * * ### Options * * - `div` - Include a wrapping div? Defaults to true. Accepts sub options similar to * FormHelper::input(). * - Other attributes will be assigned to the input element. * * @param string $caption The label appearing on the button OR if string contains :// or the * extension .jpg, .jpe, .jpeg, .gif, .png use an image if the extension * exists, AND the first character is /, image is relative to webroot, * OR if the first character is not /, image is relative to webroot/img. * @param array $options Array of options. See above. * @return string A HTML submit button * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::submit */ public function submit($caption = null, $options = array()) { // CUSTOMIZE ADD 2016/06/08 ryuring // >>> /*** beforeInput ***/ $event = $this->dispatchEvent('beforeSubmit', array('id' => $this->__id, 'caption' => $caption, 'options' => $options), array('class' => 'Form', 'plugin' => '')); if ($event !== false) { $options = $event->result === null || $event->result === true ? $event->data['options'] : $event->result; } $output = parent::submit($caption, $options); /*** afterInput ***/ $event = $this->dispatchEvent('afterSubmit', array('id' => $this->__id, 'caption' => $caption, 'out' => $output), array('class' => 'Form', 'plugin' => '')); if ($event !== false) { $output = $event->result === null || $event->result === true ? $event->data['out'] : $event->result; } return $output; // <<< }
/** * @example of use * echo $appForm->end(); * @example of output * </table> * </form> * */ function submit($caption = null, $options = array()) { $defaults = array('appBefore' => null, 'appAfter' => null); $options = array_merge($defaults, $options); $before = $options['appBefore']; $after = $options['appAfter']; unset($options['appBefore'], $options['appAfter']); $out = "<tr><th> </th><td class='vtop'>\n"; $out .= $before . parent::submit($caption, $options) . $after; $out .= "</td></tr>\n"; return $out; }
/** * Submit button * * @param string $label * * @return string */ public function submit($label = null, $options = array()) { $defaults = array('div' => 'actions', 'class' => 'btn btn-primary'); $options = array_merge($defaults, $options); return parent::submit($label, $options); }
<h2>Editar cliente</h2> <?php $id = Request::value('ident'); global $db; $c = $db->query("select * from cliente where id=" . $id, true); FormHelper::create('formCliente', '/' . APP_DIR . 'cliente/endereco'); FormHelper::input('nome', 'Nome <strong>*</strong>', $c['nome'], array('placeholder' => 'Digite o nome do cliente')); FormHelper::input('documento', "Documento (CPF/CNPJ) <strong>*</strong>", $c['documento'], array('placeholder' => 'Digite o documento', 'onkeyup' => 'App.Util.FormatarDocumento(this)')); FormHelper::input('site', "Site <strong>*</strong>", $c['site'], array('placeholder' => 'www.site.com')); ?> <input type="hidden" id="ident" name="ident" value="<?php echo $c['id']; ?> "/> <div class="well-sm alert-danger hide"> Há problemas no formulário </div> <?php FormHelper::submit('formClienteSubmit', "Adicionar endereços <span class='glyphicon glyphicon-chevron-right'></span> ", array('class' => 'btn-primary btn-lg', 'onclick' => 'App.Cliente.Submit()', 'type' => 'button'));
/** * See FormHelper::submit */ function submit($name, $options = array()) { return parent::submit($name, $options) . "\n"; }
/** * Submit * * @param string $name * @param array $settings * @return string * @access public * @since 1.0 */ public function submit($name = null, $settings = array()) { $caption = $name; $options = $settings; if (!$this->_hasComponent()) { return ''; } return parent::submit($caption, $options); }
function search() { return parent::submit('Search', array('class' => 'submit tiny')); }
public function submit($title = null, $options = []) { $title = $this->generateButtonTitle($title, $options); unset($options['ga_icon'], $options['ga_icon_after']); if (!isset($options['div'])) { $options['div'] = false; } $options = $this->addButtonClasses($options); return parent::submit($title, $options); }
/** * Creates a submit button element. This method will generate `<input />` elements that * can be used to submit, and reset forms by using $options. image submits can be created by supplying an * image path for $caption. * * ### Options * * - `div` - Include a wrapping div? Defaults to true. Accepts sub options similar to * FormHelper::input(). * - `before` - Content to include before the input. * - `after` - Content to include after the input. * - `type` - Set to 'reset' for reset inputs. Defaults to 'submit' * - Other attributes will be assigned to the input element. * * ### Options * * - `div` - Include a wrapping div? Defaults to true. Accepts sub options similar to * FormHelper::input(). * - Other attributes will be assigned to the input element. * * @param string $caption The label appearing on the button OR if string contains :// or the * extension .jpg, .jpe, .jpeg, .gif, .png use an image if the extension * exists, AND the first character is /, image is relative to webroot, * OR if the first character is not /, image is relative to webroot/img. * @param array $options Array of options. See above. * @return string A HTML submit button */ public function submit($caption = null, $options = array()) { if ($this->cherry !== false) { if (!isset($options['class'])) { $options['class'] = 'btn btn-default'; } if (!isset($options['div'])) { $options['div'] = 'form-group submit'; } if ((!isset($options['div']) || $options['div']) && !isset($options['before']) && !isset($options['between']) && !isset($options['after']) && $this->cherry === 'form-horizontal') { $options['before'] = '<div class="col-md-offset-' . $this->labelCol . ' col-md-' . $this->inputCol . '">'; $options['after'] = '</div>'; } } return parent::submit($caption, $options); }
/** * Submit * * @param $caption string * @return string */ public function submit($caption = null, $options = array()) { $options = array('class' => 'btn btn-primary'); return parent::submit($caption, $options); }
/** * Creates a submit button element. * * Extends of FormHelper::submit() so get same options and params * * ### Options by default for Twitter Bootstrap v3 * * - `div` - Set to 'false' * - 'label' - Set to 'false' * - 'class' - Set into a green button instead of a default button * * @param string $caption The label appearing on the button OR if string contains :// or the * extension .jpg, .jpe, .jpeg, .gif, .png use an image if the extension * exists, AND the first character is /, image is relative to webroot, * OR if the first character is not /, image is relative to webroot/img. * @param array $options Array of options. See above. * @return string A HTML submit button */ public function submit($caption = null, $options = array()) { $out = ''; if ($this->_getFormType() == 'horizontal') { $out .= '<div class="form-group">'; $out .= '<div class="col-md-offset-' . $this->left . ' col-md-' . $this->right . '">'; } //----- [div] option if (!isset($options['div'])) { $options['div'] = false; } //----- [label] option if (!isset($options['label'])) { $options['label'] = false; } //----- [class] option if (!isset($options['class'])) { $options['class'] = 'btn btn-success'; } else { if (is_integer(strpos($options['class'], 'btn-danger')) || is_integer(strpos($options['class'], 'btn-warning')) || is_integer(strpos($options['class'], 'btn-info'))) { $options['class'] = 'btn ' . $options['class']; } else { $options['class'] = 'btn ' . $options['class'] . ' btn-success'; } } $out .= parent::submit($caption, $options); if ($this->_getFormType() == 'horizontal') { $out .= '</div></div>'; } if ($this->_isAnAdminPanel()) { echo $out; $this->_View->end(); return ''; } return $out; }
public function submit($caption = null, $options = array()) { $defaultOptions = array('class' => 'btn btn-primary', 'div' => 'form-group', 'before' => '<div class="col-lg-offset-2 col-lg-10">', 'after' => '</div>'); $options = array_merge($defaultOptions, $options); return parent::submit($caption, $options); }
/** * Creates a submit button element. * * Extends of FormHelper::submit() so get same options and params * * ### Options by default for Twitter Bootstrap v3 * * - `div` - Set to 'false' * - 'label' - Set to 'false' * - 'class' - Set into a green button instead of a default button * * * The UX option is set to true by default * set 'ux' => false if you don't want to use it for one form * In order to correctly work, you need $faLoad and $bsAddonLoad set to true in the BsHelper * * @param string $caption The label appearing on the button OR if string contains :// or the * extension .jpg, .jpe, .jpeg, .gif, .png use an image if the extension * exists, AND the first character is /, image is relative to webroot, * OR if the first character is not /, image is relative to webroot/img. * @param array $options Array of options. See above. * @return string A HTML submit button */ public function submit($caption = null, $options = array()) { $basicOptions = array('div' => false, 'class' => 'btn btn-success', 'before' => $this->__buildSubmitBefore(), 'ux' => true); $typeOfButton = 'success'; $types = array('danger', 'warning', 'info', 'primary'); //----- [class] option if (isset($options['class'])) { $basicClass = $options['class']; $options['class'] = $basicOptions['class'] . ' ' . $options['class']; foreach ($types as $type) { if (strpos($options['class'], $type) > 0) { $typeOfButton = $type; $options['class'] = 'btn ' . $basicClass; break; } } } $options = Hash::merge($basicOptions, $options); if (!isset($options['after'])) { $options['after'] = $this->__buildSubmitAfter($options['ux'], $typeOfButton); } // Remove the 'ux' option unset($options['ux']); return parent::submit($caption, $options); }
/** * * Create & return a Twitter Like submit input. * * New options: * - bootstrap-type: Twitter bootstrap button type (primary, danger, info, etc.) * - bootstrap-size: Twitter bootstrap button size (mini, small, large) * * Unusable options: div * **/ public function submit($caption = null, $options = array()) { $options = $this->_addButtonClasses($options); if (!isset($options['div'])) { $options['div'] = false; } if (!$this->horizontal) { return parent::submit($caption, $options); } return '<div class="form-group"><div class="' . $this->_getColClass('offset') . ' ' . $this->_getColClass('input') . '">' . parent::submit($caption, $options) . '</div></div>'; }
public function submit($label = null) { $options = array('div' => 'actions', 'class' => 'btn primary'); return parent::submit($label, $options); }