Create and get tooltip attributes.

@param   array $options
@param   string $toggle
@return  array
437180
protected function _getToolTipAttr(array $options = [], $toggle = 'tooltip')
    {
        if (Arr::key('tooltip', $options)) {
            $tooltip = $options['tooltip'];
            unset($options['tooltip']);

            if (is_callable($this->getConfig('prepareTooltip'))) {
                return (array) call_user_func($this->getConfig('prepareTooltip'), $this, $options, $tooltip);
            }

            $_options = [
                'data-toggle'    => $toggle,
                'data-placement' => 'top',
            ];

            if (Arr::key('tooltipPos', $options)) {
                $_options['data-placement'] = (string) $options['tooltipPos'];
                unset($options['tooltipPos']);
            }

            $options = $this->_setTooltipTitle($tooltip, $options);

            return Hash::merge($_options, $options);
        }

        return $options;
    }
617708
function (element, options) {
    this.type       =
    this.options    =
    this.enabled    =
    this.timeout    =
    this.hoverState =
    this.$element   = null

    this.init('tooltip', element, options)
  }
1074801
public function historyBackButton(array $options = []): string
    {
        //FIXME: Add detection for IE8 & IE9 and create fallback
        $options = Hash::merge([
            'icon' => 'fa fa-arrow-left',
            'class' => 'btn btn-default btn-xs',
        ], $options);

        $div = '<div class="' . $options['class'] . '" onclick="history.back()">';
        $i = '<i class="' . $options['icon'] . '"></i>';

        return $div . $i . ' ' . __d('ck_tools', 'history_back_button') . '</div>';
    }
468077
public function getCheckboxes(array $options=[]) {
		if(isset($options['choices']))
			$choices = $options['choices'];
		else
			$choices = $this->getChoices();

		$checkboxes = [];
		foreach($choices as $k=>$v) {
			$checkbox_options = $options;
			$checkbox_options['value'] = $k;
			$checkbox_options['widget_name'] = $v;
			$checkboxes[$k] = $this->getCheckbox($v, $checkbox_options);
		}
		return $checkboxes;
	}
847151
public static function activeCheckboxListSmartToggles($model, $attribute, $items, $options = [])
    {
        $options['itemOptions']['labelOptions'] = ['class' => 'toggle'];
        return static::activeListInput('checkboxListSmart', $model, $attribute, $items, $options);
    }
321831
private function getRenderer(array $options)
    {
        if ($options['text']) {
            if ($options['badge']) {
                return function (TagInterface $tag) {
                    return sprintf(
                        '<span class="label label-%s"><i class="fa fa-%s"></i> %s</span>',
                        $tag->getTheme(), $tag->getIcon(), $tag->getName()
                    );
                };
            } else {
                return function (TagInterface $tag) {
                    return sprintf(
                        '<span class="text-%s"><i class="fa fa-%s"></i> %s</span>',
                        $tag->getTheme(), $tag->getIcon(), $tag->getName()
                    );
                };
            }
        } else {
            if ($options['badge']) {
                return function (TagInterface $tag) {
                    return sprintf(
                        '<span class="label label-%s" title="%s"><i class="fa fa-%s"></i></span>',
                        $tag->getTheme(), $tag->getName(), $tag->getIcon()
                    );
                };
            } else {
                return function (TagInterface $tag) {
                    return sprintf(
                        '<i class="text-%s fa fa-%s" title="%s"></i>',
                        $tag->getTheme(), $tag->getIcon(), $tag->getName()
                    );
                };
            }
        }
    }
327268
public function extractAttributes($options = [])
    {
        if (!is_array($options)) {
            $options = [];
        }

        if (count($this->groupStack) > 0) {
            $options = $this->mergeWithLastGroup($options);
        }

        return Arr::except($options, $this->reserved);
    }
359471
protected function _dataTooltip(array $options, $tooltip)
    {
        if (Arr::key('title', $options)) {
            $options['data-tooltip'] = $options['title'];
        }

        if (is_string($tooltip)) {
            $options['data-tooltip'] = $tooltip;
        }

        return $options;
    }
54951
public function serialize(Toggle $toggle)
    {
        return array(
            'name' => $toggle->getName(),
            'conditions' => $this->serializeConditions($toggle->getConditions()),
            'status' => $this->serializeStatus($toggle),
            'strategy' => $this->serializeStrategy($toggle)
        );
    }
108063
public function tooltip($attachTo=NULL, $params=NULL) {
		return $this->addComponent(new Tooltip($this->js), $attachTo, $params);
	}
435613
protected function _prepareTooltip(Helper $helper, array $options, $tooltip)
    {
        $_options = [
            'data-position' => 'top'
        ];

        if (Arr::key('tooltipPos', $options)) {
            $_options['data-position'] = (string) $options['tooltipPos'];
            unset($options['tooltipPos']);
        }

        $options = $this->_tooltipTitle($options, $tooltip);
        $options = $this->_dataTooltip($options, $tooltip);
        $options = $helper->addClass($options, 'hasTooltip');

        return Hash::merge($_options, $options);
    }
591639
public static function buttonToolbar(array $groups, $htmlOptions = array())
    {
        if (!empty($groups)) {
            self::addCssClass('btn-toolbar', $htmlOptions);
            $parentOptions = array(
                'color' => TbArray::popValue('color', $htmlOptions),
                'size' => TbArray::popValue('size', $htmlOptions),
                'disabled' => TbArray::popValue('disabled', $htmlOptions)
            );
            $output = self::openTag('div', $htmlOptions);
            foreach ($groups as $groupOptions) {
                if (isset($groupOptions['visible']) && $groupOptions['visible'] === false) {
                    continue;
                }
                $items = TbArray::popValue('items', $groupOptions, array());
                if (empty($items)) {
                    continue;
                }
                // todo: consider removing the support for htmlOptions.
                $options = TbArray::popValue('htmlOptions', $groupOptions, array());
                if (!empty($options)) {
                    $groupOptions = TbArray::merge($options, $groupOptions);
                }
                $groupOptions = TbArray::copyValues(array('color', 'size', 'disabled'), $parentOptions, $groupOptions);
                $output .= self::buttonGroup($items, $groupOptions);
            }
            $output .= '</div>';
            return $output;
        }
        return '';
    }
609351
public function yesNo($value, array $options = [], array $attributes = []) {
		$defaults = [
			'on' => 1,
			'onTitle' => __d('tools', 'Yes'),
			'offTitle' => __d('tools', 'No'),
		];
		$options += $defaults;

		if ($value == $options['on']) {
			$icon = 'yes';
			$value = 'on';
		} else {
			$icon = 'no';
			$value = 'off';
		}

		$attributes += ['title' => $options[$value . 'Title']];

		return $this->icon($icon, $options, $attributes);
	}
724527
public function toggleOptions($options, $state = null)
    {
        if ($state === null) {
            $state = ($this->options & $options) !== $options;
        }

        return $this->setOptions(
            $state ?
            $this->options | $options :
            $this->options & ~$options
        );
    }
615593
function showTooltipBind() {
              if (hasEnableExp && !scope.$eval(attrs[prefix + 'Enable'])) {
                return;
              }

              cancelHide();
              prepareTooltip();

              if (ttScope.popupDelay) {
                // Do nothing if the tooltip was already scheduled to pop-up.
                // This happens if show is triggered multiple times before any hide is triggered.
                if (!showTimeout) {
                  showTimeout = $timeout(show, ttScope.popupDelay, false);
                }
              } else {
                show();
              }
            }
1325769
public function getTagOptions($tag, $options)
    {
        return isset($this->tagOptions[$tag]) ? $this->tagOptions[$tag] : array();
    }
728401
public function toggleButton(array $details): string
    {
        $toggle = '
<span class="%class%" toggle_swap="%toggle_swap%" data-toggle="buttons" id="%id%_span" style="%style%" %callable%>
    <input type="hidden" value="%value%" id="%id%" name="%name%" />
    <span%icon%></span>
</span>
<label class="control_label" for="%id%">%label%
</label>';

        if (isset($details['form']))
        {
            $vars               = $details['form']->vars;

            $details['name']    = $vars['full_name'];

            $details['id']      = $vars['id'];
        }

        if (isset($details['icon'])) {
            if (is_array($details['icon'])) {
                $icon = '';
                foreach($details['icon'] as $name=>$value)
                    $icon .= $name . '="' . $value . '" ';
                $defaults['icon'] = ' ' . trim($icon);
            }
            unset($details['icon']);
        } else {
            $icon = '';
            if (preg_match('#^far | far | far$#', $details['class'], $matches) > 0) {
                $icon .= 'far ';
                $details['class'] = str_replace($matches, '', $details['class']);
            }

            if (preg_match('#^fas | fas | fas$#', $details['class'], $matches) > 0) {
                $icon .= 'fas ';
                $details['class'] = str_replace($matches, '', $details['class']);
            }

            if (preg_match('#^fal | fal | fal$#', $details['class'], $matches) > 0) {
                $icon .= 'fal ';
                $details['class'] = str_replace($matches, '', $details['class']);
            }

            if (preg_match('#^fab | fab | fab$#', $details['class'], $matches) > 0) {
                $icon .= 'fab ';
                $details['class'] = str_replace($matches, '', $details['class']);
            }

            if (preg_match('#fa-([\S][\w-]*)#', $details['class'], $matches) > 0) {
                $icon .= $matches[0] . ' ';
                $details['class'] = str_replace($matches, '', $details['class']);
            }

            $details['icon'] = ' class="' . trim($icon) . '"';
        }
        $details['toggle_swap'] = isset($details['toggle_swap']) ? $details['toggle_swap'] : 'btn-danger btn-success fa-thumbs-down fa-thumbs-up';

        $details['class']       = isset($details['class']) ? $details['class'] : 'btn far btn-success fa-thumbs-up toggleRight';

        $details['class']       .= empty($details['mergeClass']) ? '' : ' ' . $details['mergeClass'];

        $details['label']       = empty($details['label']) ? '' : $details['label'];

        $details['style']       = isset($details['style']) ? $details['style'] : 'float: right; ';

        $details['callable']    = isset($details['callable']) ? 'toggle_call="' . $details['callable'] . '"' : '';

        $toggle = str_replace(
            ['%toggle_swap%', '%class%', '%id%', '%name%', '%value%', '%label%', '%style%', '%callable%', '%icon%'],
            [$details['toggle_swap'], $details['class'], $details['id'], $details['name'], $details['value'], $details['label'], $details['style'], $details['callable'], $details['icon']],
            $toggle
        );

        return $toggle;
    }