Compile button element, inspired by ContentHyperlink.

@return void
481288
protected function compile()
    {
        $attributes = new Attributes();

        $this->setLinkTitle($attributes);
        $this->setHref($attributes);
        $this->setCssClass($attributes);
        $this->enableLightbox($attributes);
        $this->setDataAttributes($attributes);

        // Override the link target
        if ($this->target) {
            $attributes->setAttribute('target', '_blank');
        }

        if ($this->bootstrap_icon) {
            $this->Template->icon = Bootstrap::generateIcon($this->bootstrap_icon);
        }

        $this->Template->attributes = $attributes;
        $this->Template->link       = $this->linkTitle;
    }
454404
protected function compile()
	{		
		// Get the pattern model collection
		$colPattern = \PatternModel::findVisibleByPid($this->objElement->id);

		if ($colPattern === null)
		{
			return;
		}
		
		// Get correct content element id (included content element) see #37
		$intPid = ($this->origId) ? $this->origId : $this->id;
		
		// Get the data
		$colData = \DataModel::findByPid($intPid);

		if ($colData !== null)
		{
			foreach ($colData as $objData)
			{
				$arrData[$objData->pattern] = $objData;
			}							
		}

		// Prepare values for every pattern
		foreach($colPattern as $objPattern)
		{
			if (!Pattern::hasOutput($objPattern->type))
			{
				continue;
			}
			
			$strClass = Pattern::findClass($objPattern->type);
				
			if (!class_exists($strClass))
			{
				System::log('Pattern element class "'.$strClass.'" (pattern element "'.$objPattern->type.'") does not exist', __METHOD__, TL_ERROR);
			}
			else
			{
				$objPatternClass = new $strClass($objPattern);
				$objPatternClass->pid = $intPid;
				$objPatternClass->Template = $this->Template;
				$objPatternClass->data = $arrData[$objPattern->alias];
		
				$objPatternClass->compile();
			}
		}
	}
220552
protected function compile()
    {
        foreach ($this->patternCollection as $pattern) {
            $this->content = $pattern->setContent($this->content)
                ->render();
        }
    }
508600
private function compile()
    {
        $options = $replaces = [];
        $pattern = rtrim(ltrim($this->pattern, ':/'), '/');

        // correct [/ first occurrence]
        if (strpos($pattern, '[/') === 0) {
            $pattern = '[' . substr($pattern, 2);
        }

        if (preg_match_all('/<(\w+):?(.*?)?>/', $pattern, $matches)) {
            $variables = array_combine($matches[1], $matches[2]);

            foreach ($variables as $key => $segment) {
                $segment = $this->prepareSegment($key, $segment);
                $replaces["<$key>"] = "(?P<$key>$segment)";
                $options[] = $key;
            }
        }

        $template = preg_replace('/<(\w+):?.*?>/', '<\1>', $pattern);
        $options = array_fill_keys($options, null);

        foreach ($this->constrains as $key => $value) {
            if ($value instanceof Autofill) {
                // only forces value replacement, not required to be presented as parameter
                continue;
            }

            if (!array_key_exists($key, $options)) {
                throw new ConstrainException(sprintf(
                    "Route `%s` does not define routing parameter `<%s>`.",
                    $this->pattern,
                    $key
                ));
            }
        }

        $this->compiled = '/^' . strtr($template, $replaces + self::PATTERN_REPLACES) . '$/iu';
        $this->template = stripslashes(str_replace('?', '', $template));
        $this->options = $options;
    }
626071
protected function renderButtons() {
    $buttons = [];
    foreach ($this->buttons as $button) {
      if (is_array($button)) {
        $label = ArrayHelper::getValue($button, 'label');
        $url = ArrayHelper::getValue($button, 'url');
        $options = ArrayHelper::getValue($button, 'options');
        $button = Button::widget([
                'label' => $label,
                'url' => $url,
                'options' => $options,
                'encodeLabel' => $this->encodeLabels
        ]);
        $buttons[] = Html::tag('li', $button);
      } else {
        $buttons[] = Html::tag('li', $button);
      }
    }
    
    return implode("\n", $buttons);
  }
186295
public function compilePosts()
	{
		foreach ($this->site->getPosts() as $post) 
		{			
			$template = $this->twig->loadTemplate( $post->getLayout() . '.html.tpl');
			$content = $template->render(array('site' => $this->site, 'post' => $post ));
			$this->createFile($content, $post);
		}		
	}
130879
def compile(self):
        
        self.content = "".join(map(lambda x: x.compile(), self.children))
        return self._generate_html()
620053
public function append()
    {
        $args = func_get_args();
        foreach ($args as $arg) {
            if ($arg instanceof Element) {
                if ($arg->_used) {
                    continue;
                }
                $arg->_used = true;
            }
            $this->_html[] = $arg;
        }
    }
520742
protected function compileEvents() {
		foreach ( $this->events as $event => $jsCode ) {
			if ($event==="buttonClick") {
				$this->jquery_code_for_compile []="$( \"#split-".preg_replace('/[^a-zA-Z0-9\-.]/s', '', $this->attachTo)."\" ).on(\"click\" , function( event, data ) {".$jsCode."});";
			} else {
				$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
			}
		}
	}
102689
public function compile()
	{
		$objModule = \ModuleModel::findByPk($this->module);
	
		if ($objModule === null)
		{
			return;
		}
		
		$strClass = Module::findClass($objModule->type);
		
		if (!class_exists($strClass))
		{
			return;
		}
	
		$objModule->typePrefix = 'ce_';

		/** @var \Module $objModule */
		$objModule = new $strClass($objModule);
		
		$this->writeToTemplate($objModule->generate());
	}
690268
protected function buildButton()
    {
        list($content, $attr) = $this->button;

        $mid = $this->attr['id'];

        $attr = $this->escaper->attr(
            array_merge_recursive(
                $attr,
                [
                    'type'        => 'button',
                    'data-toggle' => 'modal',
                    'data-target' => "#{$mid}"
                ]
            )
        );

        $this->html .= $this->indent(0, "<button $attr>");
        $this->html .= $this->indent(1, $content);
        $this->html .= $this->indent(0, '</button>');
    }
703053
public function compile($force = false)
    {
        $jsOutputPath  = $this->outputPath['js'] . '/bootstrap.min.js';
        $cssOutputPath = $this->outputPath['css'] . '/bootstrap.min.css';

        if ($force === true || !$this->filesystem->exists($jsOutputPath)) {
            $this->filesystem->makeDirectory(dirname($jsOutputPath), 0755, true, true);
            $this->filesystem->put($jsOutputPath, $this->minifyJs());
            $this->lineToOutput('Compiled <info>JavaScript</info> was successfully written to <info>' . $jsOutputPath . '</info> file');
        }

        if ($force === true || !$this->filesystem->exists($cssOutputPath)) {
            $this->filesystem->makeDirectory(dirname($cssOutputPath), 0755, true, true);
            $this->filesystem->put($cssOutputPath, $this->minifyCss());
            $this->lineToOutput('Compiled <info>StyleSheet</info> was successfully written to <info>' . $jsOutputPath . '</info> file');
        }
    }
429301
public function compile(JsUtils $js=NULL, &$view=NULL) {
		if ($this->autoActive) {
			$this->setActive();
		}
		$count=$this->count();
		for($i=1; $i < $count; $i++) {
			$this->content[$i]->wrap($this->getContentDivider($i - 1));
		}
		return parent::compile($js, $view);
	}
482468
private function generateButton() {
        return Html::tag('button', $this->encodeLabel ? Html::encode($this->label) : $this->label, $this->buttonOptions);
    }
1356584
public function compileCategories()
	{
		foreach ($this->site->getCategories() as $category) 
		{
			$template = $this->twig->loadTemplate( 'category.html.tpl' );
			$content = $template->render(array('site' => $this->site, 'category' => $category));
			$this->createFile($content, $category);
		}
	}
467153
public function renderButton()
    {
        if (($button = $this->button) !== false) {
            $tag = ArrayHelper::remove($button, 'tag', 'a');
            $label = ArrayHelper::remove($button, 'label',
                Inflector::camel2words(Inflector::id2camel($this->scenario)));
            if ($tag === 'button' && !isset($button['type'])) {
                $toggleButton['type'] = 'button';
            }

            if ($button['disabled']) {
                $button = ArrayHelper::merge([
                    'onClick' => new JsExpression('return false'),
                ], $button);
            } else {
                $button = ArrayHelper::merge([
                    'data-toggle' => 'modal',
                    'data-target' => "#{$this->getModalId()}",
                ], $button);
            }

            if ($tag === 'a' && empty($button['href'])) {
                $button['href'] = '#';
            }

            echo Html::tag($tag, $label, $button);
        }
    }
388082
public function renderButtons() {
		
		if (empty($this->headerButtons))
			return;

		echo '<div class="pull-right">';

		if (!empty($this->headerButtons) && is_array($this->headerButtons)) {
			
			foreach ($this->headerButtons as $options) {
				
				$class = $options['class'];
				unset($options['class']);

				if (strpos($class, 'TbButton') === false)
					throw new CException('Button must be either TbButton, or TbButtonGroup');

				if (!isset($options['htmlOptions']))
					$options['htmlOptions'] = array();

				self::addCssClass($options['htmlOptions'], 'pull-right');
				
				$this->controller->widget($class, $options);
			}
		}
		echo '</div>';
	}