
ОРИГИНАЛ
static function _helper_to_panel_values() {
// add the rest
foreach (self::get_all() as $id => $config) {
$buffy_array[] = array(
'text' => $config['text'],
'title' => '',
'val' => $id,
'img' => $config['img']
);
}
// the first template is the default one, ex: it has no value in the database
$buffy_array[0]['val'] = '';
return $buffy_array;
}
ПЫТАЕМСЯ ИСПРАВИТЬ
static function _helper_to_panel_values() {
$buffy_array = array(); // Initialize the array to avoid undefined variable warning
// add the rest
foreach (self::get_all() as $id => $config) {
// Check if 'text' key exists in $config array before accessing it
$text = isset($config['text']) ? $config['text'] : '';
$img = isset($config['img']) ? $config['img'] : '';
$buffy_array[] = array(
'text' => $text,
'title' => '',
'val' => $id,
'img' => $img
);
}
// the first template is the default one, ex: it has no value in the database
$buffy_array[0]['val'] = '';
return $buffy_array;
}
Подробнее здесь: https://stackoverflow.com/questions/784 ... xt-warning