Creates a submit button at $index position
@param int $index
@param string $cssStyle
@param string $url
@param string $responseElement
@param array $attributes associative array (<b>ajax</b> key is for ajax post)
@return DataTable
12586
public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){
			$button=new HtmlButton($id,$value,$cssStyle);
			$button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]);
			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
				$this->_visibleOver($button);
				return $button;
		}, $index,$attributes);
	}
1124662
protected function _createSubFormAtIndex($index) {
        $class = 'garp-subform';
        if ($this->isDuplicatable()) {
            $class .= ' duplicatable';
        }
        $subform = new Garp_Form_SubForm(array(
            'name' => (string)$index,
            'class' => $class
        ));
        if (is_array($this->_duplicatableOptions)) {
            if (!empty($this->_duplicatableOptions['buttonClass'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-button-class', $this->_duplicatableOptions['buttonClass']);
            }
            if (!empty($this->_duplicatableOptions['buttonAddClass'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-button-add-class', $this->_duplicatableOptions['buttonAddClass']);
            }
            if (!empty($this->_duplicatableOptions['buttonRemoveClass'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-button-remove-class', $this->_duplicatableOptions['buttonRemoveClass']);
            }
            if (!empty($this->_duplicatableOptions['buttonAddLabel'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-button-add-text', $this->_duplicatableOptions['buttonAddLabel']);
            }
            if (!empty($this->_duplicatableOptions['buttonRemoveLabel'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-button-remove-text', $this->_duplicatableOptions['buttonRemoveLabel']);
            }
            if (!empty($this->_duplicatableOptions['skipElements'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-skip-elements', $this->_duplicatableOptions['skipElements']);
            }
            if (!empty($this->_duplicatableOptions['afterDuplicate'])) {
                $subform->getDecorator('HtmlTag')->setOption('data-after-duplicate', $this->_duplicatableOptions['afterDuplicate']);
            }
        }
        return $subform;
    }
335299
public function serializer(String $url, $selector = '.modal-body', $datatype = 'standart')
    {
        $selector = is_string($selector)
                  ? ($this->settings['attr']['data-target'] ?? NULL) . Base::prefix($selector, ' ')
                  : $selector;

        return $this->trigger('click', $url, $selector, $datatype, 'serializer');
    }
37561
public function post(?string $index = null, $xss_clean = false)
    {
        // Check if a field has been provided.
        if ($index === null && \count($_POST) > 0) {
            $post = [];

            // Loop through the full $_POST array and return the value.
            foreach (array_keys($_POST) as $key) {
                $post[$key] = $this->fetchFromArray($_POST, $key, $xss_clean);
            }

            return $post;
        }

	    return $this->fetchFromArray($_POST, $index, $xss_clean);
    }
1316548
public function getRequestHeader($index, $xss_clean = true)
    {
        if ($xss_clean) {
            return XssClean::getXssClean()->xss_clean($this->request->header[$index]??'');
        } else {
            return $this->request->header[$index]??'';
        }
    }
1201474
public void encodeHTML(FacesContext context, Button button)
	throws IOException {
		boolean idHasBeenRendered=false;
		if (button.getHref()!=null&&button.getOutcome()!=null) 
			throw new FacesException("Please define the href attribute or the outcome attribute, but not both");
		ResponseWriter rw = context.getResponseWriter();
		String clientId = button.getClientId();
		
		// add responsive style
		String clazz = Responsive.getResponsiveStyleClass(button, false).trim();
		boolean isResponsive = clazz.length() > 0;
		if (isResponsive) {
			rw.startElement("div", button);
			rw.writeAttribute("class", clazz, null);
			rw.writeAttribute("id", clientId, "id");
			idHasBeenRendered = true;
		}


		Object value = (button.getValue() != null ? button.getValue() : "");
		String style = button.getStyle();

		String tag = "button";
		if ((button.getHref() != null) || (button.getTarget() != null)) {
			tag="a";
		}
		rw.startElement(tag, button);
		if (!idHasBeenRendered) {
			rw.writeAttribute("id", clientId, "id");
		}
		rw.writeAttribute("name", clientId, "name");
		if ("button".equals(tag)) {
			rw.writeAttribute("type", "button", null);
		}
		if(BsfUtils.isStringValued(button.getDir())) {
			rw.writeAttribute("dir", button.getDir(), "dir");
		}
		if (style != null) {
			rw.writeAttribute("style", style, "style");
		}
		if (button.getHref() != null)
			rw.writeAttribute("href", button.getHref(), "href");
		if (button.getTarget() != null)
			rw.writeAttribute("target", button.getTarget(), "target");
		rw.writeAttribute("class", getStyleClasses(button, isResponsive), "class");

		Tooltip.generateTooltip(context, button, rw);

		final String clickHandler = encodeClick(context, button);
		if (null != clickHandler && clickHandler.length() > 0) {
			rw.writeAttribute("onclick", clickHandler, null);
		}
		if (BsfUtils.isStringValued(button.getDismiss())) {
			rw.writeAttribute("data-dismiss", button.getDismiss(), null);
		}
		if (button.isDisabled()) {
			rw.writeAttribute("disabled", "disabled", null);
		}

		// Encode attributes (HTML 4 pass-through + DHTML)
		renderPassThruAttributes(context, button, new String[] { "accesskey", "dir", "lang", "style", "tabindex", "title" });
		
		writeAttribute(rw, "onblur", button.getOnblur());
		writeAttribute(rw, "onchange", button.getOnchange());
		writeAttribute(rw, "onclick", button.getOnclick());
		writeAttribute(rw, "ondblclick", button.getOndblclick());
		writeAttribute(rw, "onfocus", button.getOnfocus());
		writeAttribute(rw, "onkeydown", button.getOnkeydown());
		writeAttribute(rw, "onkeypress", button.getOnkeypress());
		writeAttribute(rw, "onkeyup", button.getOnkeyup());
		writeAttribute(rw, "onmousedown", button.getOnmousedown());
		writeAttribute(rw, "onmousemove", button.getOnmousemove());
		writeAttribute(rw, "onmouseout", button.getOnmouseout());
		writeAttribute(rw, "onmouseover", button.getOnmouseover());
		writeAttribute(rw, "onmouseup", button.getOnmouseup());
		
		renderPassThruAttributes(context, button, button.getEventNames().toArray(new String[0]));


		String icon = button.getIcon();
		String faicon = button.getIconAwesome();
		boolean fa = false; // flag to indicate whether the selected icon set is
							// Font Awesome or not.
		if (faicon != null) {
			icon = faicon;
			fa = true;
		}
		if (icon != null) {
			Object ialign = button.getIconAlign(); // Default Left
			if (ialign != null && ialign.equals("right")) {
				rw.writeText(value + " ", null);
				IconRenderer.encodeIcon(rw, button, icon, fa, button.getIconSize(), button.getIconRotate(), button.getIconFlip(), button.isIconSpin(), null, null, false, false, false, false,
						button.isIconBrand(), button.isIconInverse(), button.isIconLight(), button.isIconPulse(), button.isIconRegular(), button.isIconRegular());
			} else {
				IconRenderer.encodeIcon(rw, button, icon, fa, button.getIconSize(), button.getIconRotate(), button.getIconFlip(), button.isIconSpin(), null, null, false, false, false, false,
						button.isIconBrand(), button.isIconInverse(), button.isIconLight(), button.isIconPulse(), button.isIconRegular(), button.isIconRegular());
				rw.writeText(" " + value, null);
			}

		} else {
			rw.writeText(value, null);
		}

		Tooltip.activateTooltips(context, button);
		rw.endElement(tag);
		if (isResponsive) {
			rw.endElement("div");
		}
	}
102808
public function link($url, $name, $position="BL", $attributes=array())
    {
        $base = str_replace(Request::path(),'',strtok(Request::fullUrl(),'?'));
        $match_url = str_replace($base, '/', strtok($url,'?'));
        if (Request::path()!= $match_url) {
            $url = Persistence::get($match_url, parse_url($url, PHP_URL_QUERY));
        }


        $attributes = array_merge(array("class"=>"btn btn-default"), $attributes);
        $this->button_container[$position][] =  HTML::link($url, $name, $attributes);
        $this->links[] = $url;

        return $this;
    }
1213802
private function putRowInIndex(&$index, $metadataNamesToIndexBy, $row, $idSite, $period)
    {
        $currentLevel = & $index;

        foreach ($metadataNamesToIndexBy as $metadataName) {
            if ($metadataName == DataTableFactory::TABLE_METADATA_SITE_INDEX) {
                $key = $idSite;
            } elseif ($metadataName == DataTableFactory::TABLE_METADATA_PERIOD_INDEX) {
                $key = $period;
            } else {
                $key = $row[self::METADATA_CONTAINER_ROW_KEY][$metadataName];
            }

            if (!isset($currentLevel[$key])) {
                $currentLevel[$key] = array();
            }

            $currentLevel = & $currentLevel[$key];
        }

        $currentLevel = $row;
    }
844419
public function server($index, $xss_clean = true)
    {
        if ($xss_clean) {
            return XssClean::getXssClean()->xss_clean($this->request->server[$index]??'');
        } else {
            return $this->request->server[$index]??'';
        }
    }
640462
public function addButtonSubmit(string $name) : Element\Button\Submit
    {
        $button = new Element\Button\Submit($this, $name);
        $this->addComponent($name, $button);

        return $button;
    }
142695
public function getHtmlStream($index = 0, $charset = MailMimeParser::DEFAULT_CHARSET)
    {
        $htmlPart = $this->getHtmlPart($index);
        if ($htmlPart !== null) {
            return $htmlPart->getContentStream($charset);
        }
        return null;
    }
1171964
static function laraform($name, $attributes = null, array $data = []) {
        $el = new ElementSelect2Twbs($name);
        $el->addClass('js-larakit-select2 form-control');
        return $el;
    }
431049
public function buildInput($attrs)
    {
        $element = $this->element() ?: static::ELEMENT_BUTTON;

        if ($element === static::ELEMENT_BUTTON) {
            $attrs['type'] = $this->buttonType() ?: 'submit';
        }

        return new HtmlElement(
            $element,
            $this->getAttribute('text', $this->getValue()),
            $attrs
        );
    }
478847
public function get($index, $xss_clean = true)
    {
        if ($xss_clean) {
            return XssClean::getXssClean()->xss_clean($this->request->get[$index]??'');
        } else {
            return $this->request->get[$index]??'';
        }
    }
734926
protected function prepareRowOptions($index, $item)
    {
        if (is_callable($this->rowOptions)) {
            $options = call_user_func($this->rowOptions, $item, $index, $this->context);
        } else {
            $options = $this->rowOptions;
        }

        Html::addCssClass($options, 'multiple-input-list__item');

        return $options;
    }
871812
private static function _pushScriptTo($index, $url, $type = 'text/javascript', $defer = false, $async = false)
	{
		if (!App::has('document'))
		{
			return;
		}

		$document = App::get('document')->instance();

		if ($document instanceof \Hubzero\Document\Type\Html)
		{
			$pushed = false;

			// Get the old data
			$data = $document->getHeadData();
			$scripts = $data['scripts'];

			// Reset the scripts data
			// We need a fresh array to reorganize things
			$data['scripts'] = array();

			// We can't reset the script data with $document->setHeadData($data); and then
			// use $document->addScript() because Document will ignore the empty array we
			// just set $data['scripts'] to and keep the old data. So, all we'd end up
			// doing is appending items. SO, we populate a new array and set the head data
			// to that.

			// Loop through old data and look for the
			// spot to insert the new data
			$i = 0;
			foreach ($scripts as $key => $foo)
			{
				// Found the spot?
				if ($i == $index)
				{
					$data['scripts'][$url] = array(
						'mime'  => $type,
						'defer' => $defer,
						'async' => $async
					);
					$pushed = true;
				}
				$data['scripts'][$key] = $foo;

				$i++;
			}

			// We didn't find out spot?
			// Append to the end
			if (!$pushed)
			{
				$data['scripts'][$url] = array(
					'mime'  => $type,
					'defer' => $defer,
					'async' => $async
				);
			}

			$document->setHeadData($data);
		}
	}
813666
public function selectButtonByIndex($index)
	{
		if ( isset($this[$index]) ) {
			/** @var RadioButton $button */
			$button = $this[$index];
			$button->select();

			return $this;
		}

		throw new RadioGroupException(
			'Cannot locate radio button with index: ' . $index,
			RadioGroupException::TYPE_NOT_FOUND
		);
	}