Skip to content
Snippets Groups Projects
  • damjan's avatar
    4a1bb03e
    [FEATURE] Flash messages · 4a1bb03e
    damjan authored
    - Catching exceptions and reporting them via flash messages in each controller action
    - Reporting success via flash messages
    - Checking response of typoScriptBackend web resource for errors and handling the errors
    - Fixing AccessArrayViewHelper not to throw error if given array is null
    - A try to convert Fluid flashMessages html to html which can be styled by Bootstrap
    4a1bb03e
    History
    [FEATURE] Flash messages
    damjan authored
    - Catching exceptions and reporting them via flash messages in each controller action
    - Reporting success via flash messages
    - Checking response of typoScriptBackend web resource for errors and handling the errors
    - Fixing AccessArrayViewHelper not to throw error if given array is null
    - A try to convert Fluid flashMessages html to html which can be styled by Bootstrap
AccessArrayViewHelper.php 624 B
<?php

namespace SGalinski\TypoScriptReferenceFrontend\ViewHelpers;

use TYPO3\Fluid\Core\ViewHelper\AbstractViewHelper;

/**
 * Class AccessArrayViewHelper renders value of the specified array at the specified index position.
 *
 * @package SGalinski\TypoScriptReferenceFrontend\ViewHelpers
 */
class AccessArrayViewHelper extends AbstractViewHelper {
	/**
	 * Renders content of $array's element with index $index
	 *
	 * @param array $array
	 * @param string|int $index
	 * @return string
	 */
	public function render($array, $index) {
		if (gettype($array) !== 'array') {
			return '';
		}
		return $array[$index];
	}
}