Generate the classes for the button based on the options set

@return string
496726
private function classes(): string
    {
        $classes = '';

        if ($this->bg_color !== null) {
            $classes = ' badge-' . $this->bg_color;
        }

        if ($this->text_color !== null) {
            $classes .= ' text-' . $this->text_color;
        }

        if ($this->pill === true) {
            $classes .= ' badge-pill';
        }

        return $classes;
    }
1077067
public function generateOptions()
    {
        $generated = [];
        array_walk($this->options, function ($value, $key) use (&$generated) {
            $result = "";
            switch ($key) {
                case "singlePage":
                    $result = $value ? "-c" : "-s";
                break;
                case "imageJpeg":
                    $result = "-fmt ".($value ? "jpg" : "png");
                break;
                case "zoom":
                    $result = "-zoom ".$value;
                break;
                case "ignoreImages":
                    $result = $value ? "-i" : "";
                break;
                case 'noFrames':
                    $result = $value ? '-noframes' : '';
                break;
            }
            $generated[] = $result;
        });

        return implode(" ", $generated);
    }
369026
private function classes(): string
    {
        $classes = '';

        if ($this->bg_color !== null) {
            $classes .= ' btn-' . $this->bg_color;
        }

        if ($this->text_color !== null) {
            $classes .= ' text-' . $this->text_color;
        }

        if ($this->outline_style !== null) {
            $classes .= ' btn-outline-' . $this->outline_style;
        }

        if ($this->large === true) {
            $classes .= ' btn-lg';
        }

        if ($this->small === true) {
            $classes .= ' btn-sm';
        }

        if ($this->block === true) {
            $classes .= ' btn-block';
        }

        if ($this->active === true) {
            $classes .= ' active';
        }

        if (count($this->custom_classes) > 0) {
            $classes .= ' ' . implode(' ', $this->custom_classes);
        }

        return $classes;
    }
409884
public function getButtonAttributes()
    {
        $attributes = [
            'class' => $this->ButtonClass,
            'data-action' => 'share',
            'data-annotation' => $this->ButtonAnnotation
        ];
        
        if ($this->ButtonAnnotation != self::ANNOTATION_VERTICAL) {
            $attributes['data-height'] = $this->ButtonHeight;
        }
        
        $this->extend('updateButtonAttributes', $attributes);
        
        return $attributes;
    }
766488
public function renderButtons()
	{
		$output='';
		foreach($this->getButtons() as $button)
			$output.=$this->renderElement($button);
		return $output!=='' ? "<div class=\"row buttons\">".$output."</div>\n" : '';
	}
39095
private static String getStyleClasses(Button button, boolean isResponsive) {
		StringBuilder sb;
		sb = new StringBuilder(40); // optimize int
		sb.append("btn");
		String size = button.getSize();
		if (size != null) {
			sb.append(" btn-").append(size);
		}

		String look = button.getLook();
		if (look != null) {
			sb.append(" btn-").append(look);
		} else {
			sb.append(" btn-default");
		}

		if (button.isDisabled()) {
			sb.append(" disabled");
		}
		if (isResponsive) {
			sb.append(" btn-block");
		}
		String sclass = button.getStyleClass();
		if (sclass != null) {
			sb.append(" ").append(sclass);
		}


		return sb.toString().trim();
	}
813951
public function generate()
    {
        $code = array();

        if ($this->namespace !== null) {
            $code[] = $this->getIndentation() . 'namespace ' . $this->namespace;
            $code[] = '{';
            $code[] = null;

            // Temporarily add one more level of indentation.
            $this->addIndentationLevel(1);
        }

        $code = array_merge($code, $this->renderUsesLines());

        $indentation = $this->getIndentation();

        $doc = $this->generateDocumentation();
        if ($doc !== null) {
            $code[] = $doc;
        }

        $line = $indentation;
        if ($this->isFinal() === true) {
            $line .= 'final ';
        } elseif ($this->isAbstract() === true) {
            $line .= 'abstract ';
        }

        $line .= 'class ' . $this->name;

        if ($this->extends !== null) {
            $line .= ' extends ' . $this->extends;
        }

        if (count($this->implements) > 0) {
            $line .= ' implements ' . implode(', ', $this->implements);
        }

        $code[] = $line;
        $code[] = $indentation . '{';

        // Class uses.
        $classElements = $this->generateTraitUsesLines();

        // Class constants.
        $classElements = array_merge($classElements, $this->generateConstantsLines());

        // Class properties.
        $classElements = array_merge($classElements, $this->generatePropertiesLines());

        // Class methods.
        $classElements = array_merge($classElements, $this->generateMethodsLines());

        if (count($classElements) > 0) {
            $code[] = null;
            $code = array_merge($code, $classElements);
            // Remove last empty line.
            array_pop($code);
        }

        $code[] = $indentation . '}';

        if ($this->namespace !== null) {
            // Set back the indentation.
            $this->addIndentationLevel(-1);

            $code[] = $this->getIndentation() . '}';
        }

        return implode($this->getLineFeed(), $code);
    }
83513
function buttonStyleClasses( buttonConfiguration ) {
      const classes = {};
      classes[ BUTTON_CLASS_ACTIVE ] = false;
      classes[ BUTTON_CLASS_HIDDEN ] = false;
      classes[ BUTTON_CLASS_DISABLED ] = false;
      classes[ BUTTON_CLASS_OMITTED ] = false;
      classes[ BUTTON_CLASS_BUSY ] = false;

      const buttonClass = buttonConfiguration[ 'class' ];
      if( buttonClass ) {
         const typePart =
            CONFIG_TO_BOOTSTRAP_STYLE_MAP[ buttonClass ] ||
            CONFIG_TO_BOOTSTRAP_STYLE_MAP.NORMAL;
         const styleClass = BUTTON_CLASS_PREFIX + typePart;
         classes[ styleClass ] = true;
      }

      const { size = 'DEFAULT' } = buttonConfiguration;
      if( size !== 'DEFAULT' ) {
         const sizeClass = BUTTON_CLASS_PREFIX + CONFIG_TO_BOOTSTRAP_SIZE_MAP[ size ];
         classes[ sizeClass ] = true;
      }

      return classes;
   }
1088229
protected function initDefaultButtons()
    {
        if($this->enableMjax) {
            MjaxAsset::register(\Yii::$app->view);
        }

        if (!isset($this->buttons['view'])) {
            $this->buttons['view'] = function ($url, $model, $key) {
                $mjaxClass = '';
                if($this->enableMjax) {
                    $mjaxClass = 'mjax';
                }
                $options = $this->buttonOption(
                    array_merge([
                        'title' => Yii::t('yii', 'View'),
                        'aria-label' => Yii::t('yii', 'View'),
                        'data-pjax' => '0',
                        'data-mjax-refresh' => 'false',
                        'class' => 'btn btn-xs btn-success ' . $mjaxClass,
                    ], $this->buttonOptions),
                    'update');
                return Html::a('<span class="fa fa-eye"></span> ' , $url, $options);
            };
        }
        if (!isset($this->buttons['update'])) {
            $this->buttons['update'] = function ($url, $model, $key) {
                $mjaxClass = '';
                if($this->enableMjax) {
                    $mjaxClass = 'mjax';
                }
                $options = $this->buttonOption(
                    array_merge([
                        'title' => Yii::t('yii', 'Update'),
                        'aria-label' => Yii::t('yii', 'Update'),
                        'data-pjax' => '0',
                        'data-mjax-refresh' => 'true',
                        'class' => 'btn btn-xs btn-primary ' . $mjaxClass,
                    ], $this->buttonOptions),
                    'update');
                return Html::a('<span class="fa fa-pencil"></span> ', $url, $options);
            };
        }
        if (!isset($this->buttons['delete'])) {
            $this->buttons['delete'] = function ($url, $model, $key) {
                $options = array_merge([
                    'title' => Yii::t('yii', 'Delete'),
                    'aria-label' => Yii::t('yii', 'Delete'),
                    'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'),
                    'data-method' => 'post',
                    'data-pjax' => '0',
                    'class' => 'btn btn-xs btn-danger ',
                ], $this->buttonOptions);
                return Html::a('<span class="fa fa-trash"></span> ' , $url, $options);
            };
        }
    }
393666
public function getPaginationButtonModeOptions()
    {
        return [
            self::BUTTON_MODE_ICON => _t(__CLASS__ . '.ICON', 'Icon Only'),
            self::BUTTON_MODE_TEXT => _t(__CLASS__ . '.TEXT', 'Text Only'),
            self::BUTTON_MODE_BOTH => _t(__CLASS__ . '.BOTH', 'Both Icon and Text')
        ];
    }
1132313
protected function getOptions()
	{
		$options = array();

		foreach ($this->element->children() as $option)
		{
			// Only add <option /> elements.
			if ($option->getName() != 'option')
			{
				continue;
			}

			// Create a new option object based on the <option /> element.
			$tmp = HtmlSelect::option(
				(string) $option['value'],
				Text::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text',
				((string) $option['disabled'] == 'true')
			);

			// Set some option attributes.
			$tmp->class = (string) $option['class'];

			// Set some JavaScript option attributes.
			$tmp->onclick = (string) $option['onclick'];

			// Add the option object to the result set.
			$options[] = $tmp;
		}

		reset($options);

		return $options;
	}
385162
public function generateClass()
    {
        $name = $this->identifier;

        // Generate a valid classname
        $name = Validator::validateClass($name, $this->config->get('namespaceName'));

        // uppercase the name
        $name = ucfirst($name);

        // Create the class object
        $comment = new PhpDocComment($this->description);
        $this->class = new PhpClass($name, false, $this->config->get('soapClientClass'), $comment);

        // Create the constructor
        $comment = new PhpDocComment();
        $comment->addParam(PhpDocElementFactory::getParam('string', 'wsdl', 'The wsdl file to use'));
        $comment->addParam(PhpDocElementFactory::getParam('array', 'options', 'A array of config values'));

        $source = '
  foreach (self::$classmap as $key => $value) {
    if (!isset($options[\'classmap\'][$key])) {
      $options[\'classmap\'][$key] = $value;
    }
  }' . PHP_EOL;
        $source .= '  $options = array_merge(' . var_export($this->config->get('soapClientOptions'), true) . ', $options);' . PHP_EOL;
        $source .= '  if (!$wsdl) {' . PHP_EOL;
        $source .= '    $wsdl = \'' . $this->config->get('inputFile') . '\';' . PHP_EOL;
        $source .= '  }' . PHP_EOL;
        $source .= '  parent::__construct($wsdl, $options);' . PHP_EOL;

        $function = new PhpFunction('public', '__construct', 'array $options = array(), $wsdl = null', $source, $comment);

        // Add the constructor
        $this->class->addFunction($function);

        // Generate the classmap
        $name = 'classmap';
        $comment = new PhpDocComment();
        $comment->setVar(PhpDocElementFactory::getVar('array', $name, 'The defined classes'));

        $init = array();
        foreach ($this->types as $type) {
            if ($type instanceof ComplexType) {
                $init[$type->getIdentifier()] = $this->config->get('namespaceName') . "\\" . $type->getPhpIdentifier();
            }
        }
        $var = new PhpVariable('private static', $name, var_export($init, true), $comment);

        // Add the classmap variable
        $this->class->addVariable($var);

        // Add all methods
        foreach ($this->operations as $operation) {
            $name = Validator::validateOperation($operation->getName());

            $comment = new PhpDocComment($operation->getDescription());
            $comment->setReturn(PhpDocElementFactory::getReturn($operation->getReturns(), ''));

            foreach ($operation->getParams() as $param => $hint) {
                $arr = $operation->getPhpDocParams($param, $this->types);
                $comment->addParam(PhpDocElementFactory::getParam($arr['type'], $arr['name'], $arr['desc']));
            }

            $source = '  return $this->__soapCall(\'' . $operation->getName() . '\', array(' . $operation->getParamStringNoTypeHints() . '));' . PHP_EOL;

            $paramStr = $operation->getParamString($this->types);

            $function = new PhpFunction('public', $name, $paramStr, $source, $comment);

            if ($this->class->functionExists($function->getIdentifier()) == false) {
                $this->class->addFunction($function);
            }
        }
    }
518705
protected function initDefaultButtons()
    {
        if (!isset($this->buttons['view'])) {
            $this->buttons['view'] = function ($url, $model, $key) {
                return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, [
                    'class'     => 'btn btn-xs btn-default',
                    'title'     => Module::t('View'),
                    'data-pjax' => '0',
                ]);
            };
        }
        if (!isset($this->buttons['update'])) {
            $this->buttons['update'] = function ($url, $model, $key) {
                return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
                    'class'     => 'btn btn-xs btn-default',
                    'title'     => Module::t('Update'),
                    'data-pjax' => '0',
                ]);
            };
        }
        if ( !isset($this->buttons['save']) ) {
            $this->buttons['save'] = function ($url, $model, $key) {
                return Html::a('<span class="glyphicon glyphicon-download"></span> ' . Module::t('Save'), $url, [
                    'class'     => 'btn btn-xs btn-success',
                    'title'     => Module::t('Save'),
                    'data-pjax' => '0',
                ]);
            };
        }
        if (!isset($this->buttons['delete'])) {
            $this->buttons['delete'] = function ($url, $model, $key) {
                return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
                    'class'         => 'btn btn-xs btn-danger margin-left-10px',
                    'title'         => Module::t('Delete'),
                    'data-confirm'  => Module::t('Are you sure you want to delete this item?'),
                    'data-method'   => 'post',
                    'data-pjax'     => '0',
                ]);
            };
        }

    }
1147861
private function renderCloneButton()
    {
        $options = [
            'class' => 'multiple-input-list__btn js-input-clone',
        ];
        Html::addCssClass($options, $this->cloneButtonOptions['class']);

        return Html::tag('div', $this->cloneButtonOptions['label'], $options);
    }
1270395
protected function getCSSClassNames()
    {
        $classes = array('swat-button');

        $form = $this->getFirstAncestor('SwatForm');
        $primary =
            $form !== null && $form->getFirstDescendant('SwatButton') === $this;

        if ($primary) {
            $classes[] = 'swat-primary';
        }

        if ($this->stock_class !== null) {
            $classes[] = $this->stock_class;
        }

        $classes = array_merge($classes, parent::getCSSClassNames());

        return $classes;
    }
706614
private function generateOptions(): string
    {
        /** @var string[] $inputs */
        $inputs = [
            (string) (new VerbosityString($this->output)),
        ];

        $userDefinition = $this->console->getUserDefinition();
        // Get user arguments
        foreach ($userDefinition->getArguments() as $argument) {
            $inputs[] = Argument::toString($this->input, $argument);
        }

        // Get user options
        foreach ($userDefinition->getOptions() as $option) {
            $inputs[] = Option::toString($this->input, $option);
        }

        return implode(' ', array_filter($inputs, static function (string $item): bool {
            return $item !== '';
        }));
    }
876895
public function generate()
    {
        // Add empty option (XHTML) if there are none
        if (empty($this->arrOptions)) {
            $this->arrOptions = array(
                array(
                    'value' => '',
                    'label' => '-'
                )
            );
        }

        $strClass = ('' !== $this->strClass ? ' class="' . $this->strClass . '"' : '');
        $strStyle = ('' !== $this->arrAttributes['style'] ? ' style="' . $this->arrAttributes['style'] . '"' : '');

        return $this->checkOptGroup($this->arrOptions, $strClass, $strStyle);
    }