code: public function addAliasButton($arrButtons)
  	{
  		// Generate the aliases
  		if (Contao\Input::post('FORM_SUBMIT') == 'tl_select' && isset($_POST['alias']))
  		{
  			/** @var Symfony\Component\HttpFoundation\Session\SessionInterface $objSession */
  			$objSession = Contao\System::getContainer()->get('session');
  
  			$session = $objSession->all();
  			$ids = $session['CURRENT']['IDS'];
  
  			foreach ($ids as $id)
  			{
  				$objArticle = Contao\ArticleModel::findByPk($id);
  
  				if ($objArticle === null)
  				{
  					continue;
  				}
  
  				$strAlias = Contao\System::getContainer()->get('contao.slug')->generate($objArticle->title, $objArticle->pid);
  
  				// The alias has not changed
  				if ($strAlias == $objArticle->alias)
  				{
  					continue;
  				}
  
  				// Initialize the version manager
  				$objVersions = new Contao\Versions('tl_article', $id);
  				$objVersions->initialize();
  
  				// Store the new alias
  				$this->Database->prepare("UPDATE tl_article SET alias=? WHERE id=?")
  							   ->execute($strAlias, $id);
  
  				// Create a new version
  				$objVersions->create();
  			}
  
  			$this->redirect($this->getReferer());
  		}
  
  		// Add the button
  		$arrButtons['alias'] = '<button type="submit" name="alias" id="alias" class="tl_submit" accesskey="a">'.$GLOBALS['TL_LANG']['MSC']['aliasSelected'].'</button> ';
  
  		return $arrButtons;
  	}
docs: Automatically generate the folder URL aliases
  
  @param array $arrButtons
  
  @return array