protected function generateButtons($arrRow, $strTable, $arrRootIds=array(), $blnCircularReference=false, $arrChildRecordIds=null, $strPrevious=null, $strNext=null)
	{
		if (empty($GLOBALS['TL_DCA'][$strTable]['list']['operations']) || !\is_array($GLOBALS['TL_DCA'][$strTable]['list']['operations']))
		{
			return '';
		}

		$return = '';

		foreach ($GLOBALS['TL_DCA'][$strTable]['list']['operations'] as $k=>$v)
		{
			$v = \is_array($v) ? $v : array($v);
			$id = StringUtil::specialchars(rawurldecode($arrRow['id']));

			$label = $v['label'][0] ?: $k;
			$title = sprintf($v['label'][1] ?: $k, $id);
			$attributes = ($v['attributes'] != '') ? ' ' . ltrim(sprintf($v['attributes'], $id, $id)) : '';

			// Add the key as CSS class
			if (strpos($attributes, 'class="') !== false)
			{
				$attributes = str_replace('class="', 'class="' . $k . ' ', $attributes);
			}
			else
			{
				$attributes = ' class="' . $k . '"' . $attributes;
			}

			// Call a custom function instead of using the default button
			if (\is_array($v['button_callback']))
			{
				$this->import($v['button_callback'][0]);
				$return .= $this->{$v['button_callback'][0]}->{$v['button_callback'][1]}($arrRow, $v['href'], $label, $title, $v['icon'], $attributes, $strTable, $arrRootIds, $arrChildRecordIds, $blnCircularReference, $strPrevious, $strNext, $this);
				continue;
			}
			elseif (\is_callable($v['button_callback']))
			{
				$return .= $v['button_callback']($arrRow, $v['href'], $label, $title, $v['icon'], $attributes, $strTable, $arrRootIds, $arrChildRecordIds, $blnCircularReference, $strPrevious, $strNext, $this);
				continue;
			}

			// Generate all buttons except "move up" and "move down" buttons
			if ($k != 'move' && $v != 'move')
			{
				if ($k == 'show')
				{
					if (!empty($v['route']))
					{
						$href = System::getContainer()->get('router')->generate($v['route'], array('id' => $arrRow['id'], 'popup' => '1'));
					}
					else
					{
						$href = $this->addToUrl($v['href'].'&amp;id='.$arrRow['id'].'&amp;popup=1');
					}

					$return .= '<a href="'.$href.'" title="'.StringUtil::specialchars($title).'" onclick="Backend.openModalIframe({\'title\':\''.StringUtil::specialchars(str_replace("'", "\\'", sprintf($GLOBALS['TL_LANG'][$strTable]['show'][1], $arrRow['id']))).'\',\'url\':this.href});return false"'.$attributes.'>'.Image::getHtml($v['icon'], $label).'</a> ';
				}
				else
				{
					if (!empty($v['route']))
					{
						$href = System::getContainer()->get('router')->generate($v['route'], array('id' => $arrRow['id']));
					}
					else
					{
						$href = $this->addToUrl($v['href'].'&amp;id='.$arrRow['id'].(Input::get('nb') ? '&amp;nc=1' : ''));
					}

					$return .= '<a href="'.$href.'" title="'.StringUtil::specialchars($title).'"'.$attributes.'>'.Image::getHtml($v['icon'], $label).'</a> ';
				}

				continue;
			}

			$arrDirections = array('up', 'down');
			$arrRootIds = \is_array($arrRootIds) ? $arrRootIds : array($arrRootIds);

			foreach ($arrDirections as $dir)
			{
				$label = $GLOBALS['TL_LANG'][$strTable][$dir][0] ?: $dir;
				$title = $GLOBALS['TL_LANG'][$strTable][$dir][1] ?: $dir;

				$label = Image::getHtml($dir.'.svg', $label);
				$href = $v['href'] ?: '&amp;act=move';

				if ($dir == 'up')
				{
					$return .= ((is_numeric($strPrevious) && (empty($GLOBALS['TL_DCA'][$strTable]['list']['sorting']['root']) || !\in_array($arrRow['id'], $arrRootIds))) ? '<a href="'.$this->addToUrl($href.'&amp;id='.$arrRow['id']).'&amp;sid='. (int) $strPrevious .'" title="'.StringUtil::specialchars($title).'"'.$attributes.'>'.$label.'</a> ' : Image::getHtml('up_.svg')).' ';
				}
				else
				{
					$return .= ((is_numeric($strNext) && (empty($GLOBALS['TL_DCA'][$strTable]['list']['sorting']['root']) || !\in_array($arrRow['id'], $arrRootIds))) ? '<a href="'.$this->addToUrl($href.'&amp;id='.$arrRow['id']).'&amp;sid='. (int) $strNext .'" title="'.StringUtil::specialchars($title).'"'.$attributes.'>'.$label.'</a> ' : Image::getHtml('down_.svg')).' ';
				}
			}
		}

		return trim($return);
	}
protected function generateButtons($arrRow, $strTable, $arrRootIds=array(), $blnCircularReference=false, $arrChildRecordIds=null, $strPrevious=null, $strNext=null)
	{
		if (empty($GLOBALS['TL_DCA'][$strTable]['list']['operations']) || !\is_array($GLOBALS['TL_DCA'][$strTable]['list']['operations']))
		{
			return '';
		}

		$return = '';

		foreach ($GLOBALS['TL_DCA'][$strTable]['list']['operations'] as $k=>$v)
		{
			$v = \is_array($v) ? $v : array($v);
			$id = StringUtil::specialchars(rawurldecode($arrRow['id']));

			$label = $v['label'][0] ?: $k;
			$title = sprintf($v['label'][1] ?: $k, $id);
			$attributes = ($v['attributes'] != '') ? ' ' . ltrim(sprintf($v['attributes'], $id, $id)) : '';

			
			if (strpos($attributes, 'class="') !== false)
			{
				$attributes = str_replace('class="', 'class="' . $k . ' ', $attributes);
			}
			else
			{
				$attributes = ' class="' . $k . '"' . $attributes;
			}

			
			if (\is_array($v['button_callback']))
			{
				$this->import($v['button_callback'][0]);
				$return .= $this->{$v['button_callback'][0]}->{$v['button_callback'][1]}($arrRow, $v['href'], $label, $title, $v['icon'], $attributes, $strTable, $arrRootIds, $arrChildRecordIds, $blnCircularReference, $strPrevious, $strNext, $this);
				continue;
			}
			elseif (\is_callable($v['button_callback']))
			{
				$return .= $v['button_callback']($arrRow, $v['href'], $label, $title, $v['icon'], $attributes, $strTable, $arrRootIds, $arrChildRecordIds, $blnCircularReference, $strPrevious, $strNext, $this);
				continue;
			}

			
			if ($k != 'move' && $v != 'move')
			{
				if ($k == 'show')
				{
					if (!empty($v['route']))
					{
						$href = System::getContainer()->get('router')->generate($v['route'], array('id' => $arrRow['id'], 'popup' => '1'));
					}
					else
					{
						$href = $this->addToUrl($v['href'].'&amp;id='.$arrRow['id'].'&amp;popup=1');
					}

					$return .= '<a href="'.$href.'" title="'.StringUtil::specialchars($title).'" onclick="Backend.openModalIframe({\'title\':\''.StringUtil::specialchars(str_replace("'", "\\'", sprintf($GLOBALS['TL_LANG'][$strTable]['show'][1], $arrRow['id']))).'\',\'url\':this.href});return false"'.$attributes.'>'.Image::getHtml($v['icon'], $label).'</a> ';
				}
				else
				{
					if (!empty($v['route']))
					{
						$href = System::getContainer()->get('router')->generate($v['route'], array('id' => $arrRow['id']));
					}
					else
					{
						$href = $this->addToUrl($v['href'].'&amp;id='.$arrRow['id'].(Input::get('nb') ? '&amp;nc=1' : ''));
					}

					$return .= '<a href="'.$href.'" title="'.StringUtil::specialchars($title).'"'.$attributes.'>'.Image::getHtml($v['icon'], $label).'</a> ';
				}

				continue;
			}

			$arrDirections = array('up', 'down');
			$arrRootIds = \is_array($arrRootIds) ? $arrRootIds : array($arrRootIds);

			foreach ($arrDirections as $dir)
			{
				$label = $GLOBALS['TL_LANG'][$strTable][$dir][0] ?: $dir;
				$title = $GLOBALS['TL_LANG'][$strTable][$dir][1] ?: $dir;

				$label = Image::getHtml($dir.'.svg', $label);
				$href = $v['href'] ?: '&amp;act=move';

				if ($dir == 'up')
				{
					$return .= ((is_numeric($strPrevious) && (empty($GLOBALS['TL_DCA'][$strTable]['list']['sorting']['root']) || !\in_array($arrRow['id'], $arrRootIds))) ? '<a href="'.$this->addToUrl($href.'&amp;id='.$arrRow['id']).'&amp;sid='. (int) $strPrevious .'" title="'.StringUtil::specialchars($title).'"'.$attributes.'>'.$label.'</a> ' : Image::getHtml('up_.svg')).' ';
				}
				else
				{
					$return .= ((is_numeric($strNext) && (empty($GLOBALS['TL_DCA'][$strTable]['list']['sorting']['root']) || !\in_array($arrRow['id'], $arrRootIds))) ? '<a href="'.$this->addToUrl($href.'&amp;id='.$arrRow['id']).'&amp;sid='. (int) $strNext .'" title="'.StringUtil::specialchars($title).'"'.$attributes.'>'.$label.'</a> ' : Image::getHtml('down_.svg')).' ';
				}
			}
		}

		return trim($return);
	}
protected function generateButtons ( $ arrRow , $ strTable , $ arrRootIds = array ( ) , $ blnCircularReference = false , $ arrChildRecordIds = null , $ strPrevious = null , $ strNext = null ) { if ( empty ( $ GLOBALS [ 'TL_DCA' ] [ $ strTable ] [ 'list' ] [ 'operations' ] ) || ! \ is_array ( $ GLOBALS [ 'TL_DCA' ] [ $ strTable ] [ 'list' ] [ 'operations' ] ) ) { return '' ; } $ return = '' ; foreach ( $ GLOBALS [ 'TL_DCA' ] [ $ strTable ] [ 'list' ] [ 'operations' ] as $ k => $ v ) { $ v = \ is_array ( $ v ) ? $ v : array ( $ v ) ; $ id = StringUtil :: specialchars ( rawurldecode ( $ arrRow [ 'id' ] ) ) ; $ label = $ v [ 'label' ] [ 0 ] ? : $ k ; $ title = sprintf ( $ v [ 'label' ] [ 1 ] ? : $ k , $ id ) ; $ attributes = ( $ v [ 'attributes' ] != '' ) ? ' ' . ltrim ( sprintf ( $ v [ 'attributes' ] , $ id , $ id ) ) : '' ; // Add the key as CSS class if ( strpos ( $ attributes , 'class="' ) !== false ) { $ attributes = str_replace ( 'class="' , 'class="' . $ k . ' ' , $ attributes ) ; } else { $ attributes = ' class="' . $ k . '"' . $ attributes ; } // Call a custom function instead of using the default button if ( \ is_array ( $ v [ 'button_callback' ] ) ) { $ this -> import ( $ v [ 'button_callback' ] [ 0 ] ) ; $ return .= $ this -> { $ v [ 'button_callback' ] [ 0 ] } -> { $ v [ 'button_callback' ] [ 1 ] } ( $ arrRow , $ v [ 'href' ] , $ label , $ title , $ v [ 'icon' ] , $ attributes , $ strTable , $ arrRootIds , $ arrChildRecordIds , $ blnCircularReference , $ strPrevious , $ strNext , $ this ) ; continue ; } elseif ( \ is_callable ( $ v [ 'button_callback' ] ) ) { $ return .= $ v [ 'button_callback' ] ( $ arrRow , $ v [ 'href' ] , $ label , $ title , $ v [ 'icon' ] , $ attributes , $ strTable , $ arrRootIds , $ arrChildRecordIds , $ blnCircularReference , $ strPrevious , $ strNext , $ this ) ; continue ; } // Generate all buttons except "move up" and "move down" buttons if ( $ k != 'move' && $ v != 'move' ) { if ( $ k == 'show' ) { if ( ! empty ( $ v [ 'route' ] ) ) { $ href = System :: getContainer ( ) -> get ( 'router' ) -> generate ( $ v [ 'route' ] , array ( 'id' => $ arrRow [ 'id' ] , 'popup' => '1' ) ) ; } else { $ href = $ this -> addToUrl ( $ v [ 'href' ] . '&amp;id=' . $ arrRow [ 'id' ] . '&amp;popup=1' ) ; } $ return .= '<a href="' . $ href . '" title="' . StringUtil :: specialchars ( $ title ) . '" onclick="Backend.openModalIframe({\'title\':\'' . StringUtil :: specialchars ( str_replace ( "'" , "\\'" , sprintf ( $ GLOBALS [ 'TL_LANG' ] [ $ strTable ] [ 'show' ] [ 1 ] , $ arrRow [ 'id' ] ) ) ) . '\',\'url\':this.href});return false"' . $ attributes . '>' . Image :: getHtml ( $ v [ 'icon' ] , $ label ) . '</a> ' ; } else { if ( ! empty ( $ v [ 'route' ] ) ) { $ href = System :: getContainer ( ) -> get ( 'router' ) -> generate ( $ v [ 'route' ] , array ( 'id' => $ arrRow [ 'id' ] ) ) ; } else { $ href = $ this -> addToUrl ( $ v [ 'href' ] . '&amp;id=' . $ arrRow [ 'id' ] . ( Input :: get ( 'nb' ) ? '&amp;nc=1' : '' ) ) ; } $ return .= '<a href="' . $ href . '" title="' . StringUtil :: specialchars ( $ title ) . '"' . $ attributes . '>' . Image :: getHtml ( $ v [ 'icon' ] , $ label ) . '</a> ' ; } continue ; } $ arrDirections = array ( 'up' , 'down' ) ; $ arrRootIds = \ is_array ( $ arrRootIds ) ? $ arrRootIds : array ( $ arrRootIds ) ; foreach ( $ arrDirections as $ dir ) { $ label = $ GLOBALS [ 'TL_LANG' ] [ $ strTable ] [ $ dir ] [ 0 ] ? : $ dir ; $ title = $ GLOBALS [ 'TL_LANG' ] [ $ strTable ] [ $ dir ] [ 1 ] ? : $ dir ; $ label = Image :: getHtml ( $ dir . '.svg' , $ label ) ; $ href = $ v [ 'href' ] ? : '&amp;act=move' ; if ( $ dir == 'up' ) { $ return .= ( ( is_numeric ( $ strPrevious ) && ( empty ( $ GLOBALS [ 'TL_DCA' ] [ $ strTable ] [ 'list' ] [ 'sorting' ] [ 'root' ] ) || ! \ in_array ( $ arrRow [ 'id' ] , $ arrRootIds ) ) ) ? '<a href="' . $ this -> addToUrl ( $ href . '&amp;id=' . $ arrRow [ 'id' ] ) . '&amp;sid=' . ( int ) $ strPrevious . '" title="' . StringUtil :: specialchars ( $ title ) . '"' . $ attributes . '>' . $ label . '</a> ' : Image :: getHtml ( 'up_.svg' ) ) . ' ' ; } else { $ return .= ( ( is_numeric ( $ strNext ) && ( empty ( $ GLOBALS [ 'TL_DCA' ] [ $ strTable ] [ 'list' ] [ 'sorting' ] [ 'root' ] ) || ! \ in_array ( $ arrRow [ 'id' ] , $ arrRootIds ) ) ) ? '<a href="' . $ this -> addToUrl ( $ href . '&amp;id=' . $ arrRow [ 'id' ] ) . '&amp;sid=' . ( int ) $ strNext . '" title="' . StringUtil :: specialchars ( $ title ) . '"' . $ attributes . '>' . $ label . '</a> ' : Image :: getHtml ( 'down_.svg' ) ) . ' ' ; } } } return trim ( $ return ) ; }
Compile buttons from the table configuration array and return them as HTML

@param array   $arrRow
@param string  $strTable
@param array   $arrRootIds
@param boolean $blnCircularReference
@param array   $arrChildRecordIds
@param string  $strPrevious
@param string  $strNext

@return string
Compile buttons from the table configuration array and return them as HTML