Create and return a Button component
@param string $attachTo css/jquery selector attached to the component
@param array $params php array of parameters
@return Button
498092
public function button($attachTo=NULL, $params=NULL) {
		return $this->addComponent(new Button($this->js), $attachTo, $params);
	}
634280
public function create($name, $params = [ ])
    {
        if ($name !== null) {
            $name = $this->getName($name);
        } else {
            $name = $this->_base;
        }

        if (!isset($params['rule'])) {
            $params['rule'] = $this->_rule;
        }

        if (!isset($params['class'])) {
            $params['class'] = $this->_class;
        }

        return $this->link($name, $params);
    }
11420
public function getCsrfToken(string $control, string $method, array $params): string
	{
		return Helpers::getCsrfToken($this->getSession(), $control, $method, $params);
	}
696326
public static function checkBox($name, $checked = false, $htmlOptions = array())
    {
        $label = TbArray::popValue('label', $htmlOptions, false);
        $labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());
        self::addCssClass('checkbox', $labelOptions);
        $input = parent::checkBox($name, $checked, $htmlOptions);
        return self::createCheckBoxAndRadioButtonLabel($label, $input, $labelOptions);
    }
714082
public static function tag( $name, $param1 = null, $param2 = null ) 
	{
		return static::create( $name, $param1, $param2 );
	}
854783
protected function createModal($title, $content = null, array $buttons = [])
    {
        $modal = new Modal($title);

        $buttons = [];

        if (empty($buttons)) {
            $buttons['submit'] = [
                'id'       => 'submit',
                'label'    => 'ekyna_core.button.save',
                'icon'     => 'glyphicon glyphicon-ok',
                'cssClass' => 'btn-success',
                'autospin' => true,
            ];
        }
        if (!array_key_exists('close', $buttons)) {
            $buttons['close'] = [
                'id'       => 'close',
                'label'    => 'ekyna_core.button.cancel',
                'icon'     => 'glyphicon glyphicon-remove',
                'cssClass' => 'btn-default',
            ];
        }

        $modal->setButtons($buttons);

        if ($content) {
            $modal->setContent($content);
        }

        return $modal;
    }
76510
public static function method(
    $name,
    $params = [],
    $visibility = 'public',
    $body = '//todo',
    $docblock = ''
  )
  {
    if (empty($docblock))
    {
      if (!empty($params))
      {
        $docblock = new DocBlockGenerator();
        foreach ($params as $param)
        {
          $tag = new Tag('param', $param->getType() . ' $' . $param->getName());
          $docblock->setTag($tag);
        }
      }
    }

    return (new MethodGenerator($name, $params))
    ->setBody($body)
    ->setVisibility($visibility)
    ->setDocBlock($docblock)
    ->setIndentation(Generator::$indentation);
  }
1365711
public function addButton(string $title = null, array $options = []): string
    {
        if (!$title) {
            $title = __d('ck_tools', 'add');
        }
        $options = Hash::merge([
            'url' => null,
            'icon' => 'fa fa-plus',
            'class' => 'btn btn-default btn-xs btn-add',
        ], $options);
        $url = $options['url'];
        if (!$url) {
            $url = ['action' => 'add'];
            $url = $this->augmentUrlByBackParam($url);
        }
        $icon = $options['icon'];
        unset($options['url'], $options['icon']);
        if ($icon) {
            $title = '<i class="' . $icon . '"></i> ' . '<span class="button-text">' . $title . '</span>';
            $options['escape'] = false;
        }

        return $this->Html->link($title, $url, $options);
    }
511230
static function laraform($name = '', $options) {
        $gr = new ElementGroupCheckboxButtonTwbs($name);
        $gr->setAttribute('data-toggle', 'buttons');
        foreach ($options as $k => $v) {
            $gr->putCheckboxTwbs($k, $k)
                ->setAttribute('autocomplete', 'off')
                ->setLabel($v);
        }
        return $gr;
    }
1344304
public function createActionButtons(\MUtil_Model_Bridge_TableBridge $bridge)
    {
        $tData = $this->util->getTokenData();

        // Action links
        $actionLinks['ask']    = $tData->getTokenAskLinkForBridge($bridge, true);
        $actionLinks['email']  = $tData->getTokenEmailLinkForBridge($bridge);
        $actionLinks['answer'] = $tData->getTokenAnswerLinkForBridge($bridge);

        $output = [];
        foreach ($actionLinks as $key => $actionLink) {
            if ($actionLink) {
                $output[] = ' ';
                $output[$key] = \MUtil_Html::create(
                        'div',
                        $actionLink,
                        ['class' => 'rightFloat', 'renderWithoutContent' => false, 'style' => 'clear: right;']
                        );
            }
        }

        return $output;
    }
787417
public function addButtonRemote($name, $label = '%s', $link = '#', $binds = [], $method = 'post' )
    {
        return $this->addButton($name, $label, $link, $binds)->enableRemote($method);
    }
1123100
@Programmatic
    public List<Paperclip> findByAttachedTo(final Object attachedTo) {
        if(attachedTo == null) {
            return null;
        }
        final Bookmark bookmark = bookmarkService.bookmarkFor(attachedTo);
        if(bookmark == null) {
            return null;
        }
        final String attachedToStr = bookmark.toString();
        return repositoryService.allMatches(
                new QueryDefault<>(Paperclip.class,
                        "findByAttachedTo",
                        "attachedToStr", attachedToStr));
    }
91520
function attachSelectionMethods(box) {
  box.selected = 0;

  var nextTop = 0;
  var items = {};

  box.layout = function() {
    nextTop = 1;
    box.children.forEach(function(child) {
      child.top = nextTop;
      child.height = child.getScreenLines().length;
      nextTop += child.height;
    })
  }

  box.addItem = function(text, itemKey, itemData) {
    var node = blessed.text({
        left: 0,
        right: 0,
        top: nextTop,
        height: 1,
        tags: true,
        content: text
    });
    node.itemData = itemData;
    items[itemKey] = node;
    box.append(node);
    node.height = node.getScreenLines().length;
    nextTop += node.height;
  }

  box.getItem = function(itemKey) {
    return items[itemKey];
  }

  box.selectItem = function(itemKey) {
    var item = box.getItem(itemKey);
    if (!item) {
      return;
    }
    var i = box.children.indexOf(item);
    if (i == -1) {
      return;
    }
    box.select(i);
  }

  box.removeItem = function(itemKey) {
    var item = items[itemKey];
    if (!item) {
      return;
    }
    delete items[itemKey];
    item.detach();
    box.layout();
  }

  box.clearItems = function() {
    box.children.slice().forEach(function(child) {
      child.detach();
    });
    box.selected = -1;
    nextTop = 0;
    items = {};
  }

  box.up = function(n) {
    if (box.selected == -1) {
      box.select(box.children.length - 1);
    } else {
      n = n === undefined ? 1 : n;
      box.select(box.selected - n);
    }
  }

  box.down = function(n) {
    if (box.selected == -1) {
      box.select(box.children.length - 1);
    } else {
      n = n === undefined ? 1 : n;
      box.select(box.selected + n);
    }
  }

  box.select = function(n) {
    highlight(box.selected, false);
    n = Math.max(0, Math.min(box.children.length - 1, n));
    if (n == -1) {
      return;
    }
    box.selected = n;
    highlight(n, true);
  }

  box.getSelectedItem = function() {
    return box.children[box.selected];
  }

  function highlight(n, on) {
    var item = box.children[n];
    if (!item) {
      return;
    }
    item.style.inverse = on;
  }
}
264086
protected function find_button(array &$params, $button) {
        foreach ($params as $key => $value) {
            if (preg_match('/^theme_advanced_buttons(\d+)$/', $key, $matches) &&
                    strpos(','. $value. ',', ','. $button. ',') !== false) {
                return (int)$matches[1];
            }
        }
        return false;
    }
1258130
static function createOperatorElement( $name, $parameters = array(), $variablePlacement = false )
    {
        return array( eZTemplate::TYPE_ATTRIBUTE,
                      array_merge( array( $name ), $parameters ), $variablePlacement );
    }
322297
public function addButtonButton(string $name) : Element\Button\Button
    {
        $button = new Element\Button\Button($this, $name);
        $this->addComponent($name, $button);

        return $button;
    }
1234764
@Override
	public ControllerLinkBuilder linkTo(Method method, Object... parameters) {
		return ControllerLinkBuilder.linkTo(method, parameters);
	}