core-bundle/src/Resources/contao/widgets/SectionWizard.php
protected function validator($varInput)
	{
		$arrTitles = array();
		$arrIds = array();
		$arrSections = array();

		foreach ($varInput as $arrSection)
		{
			// Title and ID are required
			if ((!empty($arrSection['title']) && empty($arrSection['id'])) || (empty($arrSection['title']) && !empty($arrSection['id'])))
			{
				$this->addError($GLOBALS['TL_LANG']['ERR']['emptyTitleOrId']);
			}

			// Check for duplicate section titles
			if (\in_array($arrSection['title'], $arrTitles))
			{
				$this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['duplicateSectionTitle'], $arrSection['title']));
			}

			$arrSection['id'] = StringUtil::standardize($arrSection['id'], true);

			// Add a suffix to reserved names (see #301)
			if (\in_array($arrSection['id'], array('top', 'wrapper', 'header', 'container', 'main', 'left', 'right', 'footer')))
			{
				$arrSection['id'] .= '-custom';
			}

			// Check for duplicate section IDs
			if (\in_array($arrSection['id'], $arrIds))
			{
				$this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['duplicateSectionId'], $arrSection['id']));
			}

			$arrTitles[] = $arrSection['title'];
			$arrIds[] = $arrSection['id'];
			$arrSections[] = $arrSection;
		}

		return $arrSections;
	}
protected function validator($varInput)
	{
		$arrTitles = array();
		$arrIds = array();
		$arrSections = array();

		foreach ($varInput as $arrSection)
		{
			// Title and ID are required
			if ((!empty($arrSection['title']) && empty($arrSection['id'])) || (empty($arrSection['title']) && !empty($arrSection['id'])))
			{
				$this->addError($GLOBALS['TL_LANG']['ERR']['emptyTitleOrId']);
			}

			// Check for duplicate section titles
			if (\in_array($arrSection['title'], $arrTitles))
			{
				$this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['duplicateSectionTitle'], $arrSection['title']));
			}

			$arrSection['id'] = StringUtil::standardize($arrSection['id'], true);

			// Add a suffix to reserved names (see #301)
			if (\in_array($arrSection['id'], array('top', 'wrapper', 'header', 'container', 'main', 'left', 'right', 'footer')))
			{
				$arrSection['id'] .= '-custom';
			}

			// Check for duplicate section IDs
			if (\in_array($arrSection['id'], $arrIds))
			{
				$this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['duplicateSectionId'], $arrSection['id']));
			}

			$arrTitles[] = $arrSection['title'];
			$arrIds[] = $arrSection['id'];
			$arrSections[] = $arrSection;
		}

		return $arrSections;
	}
protected function validator ( $ varInput ) { $ arrTitles = array ( ) ; $ arrIds = array ( ) ; $ arrSections = array ( ) ; foreach ( $ varInput as $ arrSection ) { // Title and ID are required if ( ( ! empty ( $ arrSection [ 'title' ] ) && empty ( $ arrSection [ 'id' ] ) ) || ( empty ( $ arrSection [ 'title' ] ) && ! empty ( $ arrSection [ 'id' ] ) ) ) { $ this -> addError ( $ GLOBALS [ 'TL_LANG' ] [ 'ERR' ] [ 'emptyTitleOrId' ] ) ; } // Check for duplicate section titles if ( \ in_array ( $ arrSection [ 'title' ] , $ arrTitles ) ) { $ this -> addError ( sprintf ( $ GLOBALS [ 'TL_LANG' ] [ 'ERR' ] [ 'duplicateSectionTitle' ] , $ arrSection [ 'title' ] ) ) ; } $ arrSection [ 'id' ] = StringUtil :: standardize ( $ arrSection [ 'id' ] , true ) ; // Add a suffix to reserved names (see #301) if ( \ in_array ( $ arrSection [ 'id' ] , array ( 'top' , 'wrapper' , 'header' , 'container' , 'main' , 'left' , 'right' , 'footer' ) ) ) { $ arrSection [ 'id' ] .= '-custom' ; } // Check for duplicate section IDs if ( \ in_array ( $ arrSection [ 'id' ] , $ arrIds ) ) { $ this -> addError ( sprintf ( $ GLOBALS [ 'TL_LANG' ] [ 'ERR' ] [ 'duplicateSectionId' ] , $ arrSection [ 'id' ] ) ) ; } $ arrTitles [ ] = $ arrSection [ 'title' ] ; $ arrIds [ ] = $ arrSection [ 'id' ] ; $ arrSections [ ] = $ arrSection ; } return $ arrSections ; }
Standardize the ID

@param mixed $varInput

@return mixed
Standardize the ID