link-in - רשומות קוד

חפש את הקוד שלך >

debug in magento whit kint

פתיחת קובץ app/bootstrap.php

לשים בהערה את השורת קוד : 
if (in_array('phar', \stream_get_wrappers())) {
//    stream_wrapper_unregister('phar');
}

להכניס את הקבצים לתקיה

lib/internal/kint/kint.phar 
או pub/kint.phar

לדרוש את הקובץ בראש המודול

require_once($_SERVER["DOCUMENT_ROOT"].'/kint.phar');
//Include kint debugger
try {
if (! @include_once( $_SERVER["DOCUMENT_ROOT"].'/kint.phar' )) // @ - to suppress warnings,
// you can also use error_reporting function for the same purpose which may be a better option
throw new Exception ('functions.php does not exist');
else
require_once($_SERVER["DOCUMENT_ROOT"].'/kint.phar');
}
catch(Exception $e) {
echo "Message : " . $e->getMessage();
echo "Code : " . $e->getCode();

}

<?php
namespace Anagal\SlickSliderDebug\Block;
use Magento\Framework\App\Config\ScopeConfigInterface;

require_once('lib/internal/kint/kint.phar');

class SlickSliderDebug extends \Magento\Framework\View\Element\Template{

    public function getConfigValue($value){

        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $scopeConfig = $objectManager->get(ScopeConfigInterface::class);
        d($scopeConfig);
        return $scopeConfig->getValue($value);
    }
    public function isEnabled(){
        return $this->getConfigValue('newblocktab/general/enable');
    }
    public function getDisplayText($filed){
        return $this->getConfigValue($filed);
    }
}