CodeIgniter 4 - how to turn off display of debugger toolbar - without changing CI_ENVIRONMENT?
Changing environment variable CI_ENVIRONMENT to production will turn off the debug toolbar - but will also suppress errors.
I want to still see errors - but I do not want to see the debug toolbar at the bottom of all of my views when in 'development' mode.
Removing toolbar from $gloabals['after'] in app\config\Filters also do the trick.
Source: https://forum.codeigniter.com/showthread.php?tid=76243&pid=375043#pid375043
You should remove (or comment) the 'toolbar' filter in App\Config\Filters.php as told in the official CI4 documentation.
public $globals = [
'before' => [
// 'honeypot',
// 'csrf',
],
'after' => [
//'toolbar',
// 'honeypot',
],
];
Setting CI_DEBUG to 'false' - in \app\Config\Boot\development.php - will hide the 'KINT' toolbar; but allow CodeIgniter's error display to continue.
defined('CI_DEBUG') || define('CI_DEBUG', false);
https://codeigniter4.github.io/CodeIgniter4/testing/debugging.html
"the excellent Kint debugging tool for PHP. It will be enabled whenever the constant CI_DEBUG is defined and its value is truthy. This is defined in the boot files (e.g. app/Config/Boot/development.php)."
Related
I have built a small web application using Laravel 8 and I was requested to integrate AdminLTE to it.
I am new to AdminLTE and part of the requirements is to translate the pages content, but I had no idea of how to create such menu.
The idea is to come to this:
Here I want explain how I got there. It took me some hours to understand how this works so I think someone else could benefit from my work.
I am assuming you have already successfully integrated the AdminLTE dashboard to your Laravel application.
The key is to open the file C:\your_web_app_folder\config\adminlte.php with your preferred text editor.
Find the "Menu Items" section and add the following text inside the 'menu' => [] element:
[
'text' => 'Language',
'topnav_right' => true,
'icon' => 'flag-icon flag-icon-us',
'submenu' => [
[
'text'=>'English',
'icon' => 'flag-icon flag-icon-us',
'url'=> '#'
],
[
'text'=>'Khmer',
'icon' => 'flag-icon flag-icon-kh',
'url'=> '#'
]
]
],
Such text can be inserted after the search textbox or wherever you consider it more convenient to you.
The 'text' sets the text that will be shown on your link (optional).
The 'topnav_right' indicates that the language menu will be located on the right side of the navigation bar.
The 'icon', in this case, is going to contain the CSS class that will display the desired icon flag. For this to work, it is necessary to load the respective CSS file which is located in the folder \public\vendor\flag-icon-css\css\flag-icon.css, assuming you previously published those assets using the artisan commands specified in the documentation (https://github.com/jeroennoten/Laravel-AdminLTE/wiki/5.-Artisan-Console-Commands)
Proceeding like this you will have all those CSS/JS/images copied to your \public\vendor folder for easier reference.
There is nothing else to do to create those menus you see on the top nav (notifications, messages, languages, etc). All of them can be built in the same way.
Whenever a link is typed in the RTE editor, it will automatically be enclosed in an tag and converted to a link.
Is there a way to stop this behavior, other than removing each link manually?
I'm not that much of an expert, but I tried to use the "minimal.yaml" configuration for the RTE editor, and It basically done what I wanted since the minimal setting doesn't have the linking option at all, but I need all the other options that are not available in the minimal, and I need the option to create a link manually when needed, just not automatically.
You need to add a custom configuration file for the RTE. Follow this guide to do so : https://usetypo3.com/ckeditor.html
After that, in the removePlugins section, add - autolinking like this :
# Load default processing options
imports:
...
editor:
config:
...
removePlugins:
- autolinking
What I did, I commented the lined where the autolinking.js actually creates a URL from the typed link and commented that out.
I don't think this is the optimal solution, but it's doing what it's supposed to.
/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/Plugins/autolinking.js
editor.on('key', function(evt) {
if (this.mode !== 'source') {
if (evt.data.keyCode === spaceChar || evt.data.keyCode === tabChar || evt.data.keyCode === enterChar) {
//editor.autolinking(evt);
}
}
I've read many posts regarding the lack of documentation for button lists in CKEditor 4, and I've found posts where individuals even posted a list of button Items based on their testing.
However, what my client has asked is to remove specific buttons within the Source group - the Comment, Uncomment and HTML Tag Autocomplete buttons.
Does anyone know the correct button names for these buttons that will work with removeButtons()?
I've tested the obvious - Comment,Uncomment,Autocomplete - but they have no effect.
Thanks.
I know it is late for the OP, but for anyone interested, the default configuration for the CodeMirror plug-in toolbar is (Sourcedialog included):
{ name: 'document', items: [ 'Source', 'Sourcedialog', 'autoFormat', 'CommentSelectedRange', 'UncommentSelectedRange', 'AutoComplete' ] }
To remove specific buttons with the removeButtons() function you can add each button name to the array, so for the case in question:
removeButtons: 'CommentSelectedRange,UncommentSelectedRange,AutoComplete'
Notice the names of the buttons are case-sensitive.
For whomever stumbles upon this later on.
The buttons are added by the codemirror plugin. Codemirror has configuration to not include these buttons.
CKEDITOR.config.codemirror = {
// Whether or not to show the search Code button on the toolbar
showSearchButton: false,
// Whether or not to show Trailing Spaces
showTrailingSpace: true,
// Whether or not to show the format button on the toolbar
showFormatButton: false,
// Whether or not to show the comment button on the toolbar
showCommentButton: false,
// Whether or not to show the uncomment button on the toolbar
showUncommentButton: false,
// Whether or not to show the showAutoCompleteButton button on the toolbar
showAutoCompleteButton: false
};
I'm using CKEditor in my Rails app (via the 'ckeditor' gem).
I've customized the toolbar as below. As you can see, I only want the minimum amount of features.
[
{ name: 'basicstyles', items : [ 'Bold','Underline' ] },
{ name: 'paragraph', items : [ 'NumberedList','BulletedList' ] },
{ name: 'links', items : [ 'Link' ] },
{ name: 'insert', items : [ 'Smiley','SpecialChar' ] },
{ name: 'colors', items : [ 'TextColor' ] },
];
This works fine, but the buttons provide much more functionality than I need.
For example, the Link button triggers a popup that allows the user to choose details like link type and target. I want to restrict my users to exactly one kind of link. (ie. when they click the link button, all they need to do is enter the link, and they see no options and have no decisions to make.)
For Text Color, I just want two or three colors, instead of the 50+ that are provided.
How can I make these changes?
Would appreciate it if you could provide input, or point me to some resources. Thanks!
To make these changes, you'll need to rewrite the desired plugins in order to customize their funcionality.
You can find further info about it here: http://docs.ckeditor.com/#!/guide/plugin_sdk_intro
In order not to break compatibility with newer versions, I suggest you to create new plugins based in the ones you want to modify instead of doing that directly in their source code.
You can try the Advanced Content Filter that we introduced in CKEditor 4.1. Based on content rules which you can define editor data is filtered and the same happens to UI - only "allowed" buttons and fields in dialogs are displayed. It all happens automatically, so the result may not be perfect, but we have really positive feedback about this feature.
Check the ACF sample and release note.
I have created my first Magento widget on a test site (same code and configuration as my live site). The widget works perfectly on the test site. However, having moved the code to the live site, I can configure the widget instance, but the output of the widget is not showing on the product page. So I know Magento is pulling information from the widget's config.xml and widget.xml files.
I have confirmed that the correct layout update is being inserted in the core_layout_update table. The information on the live system's table is exactly the same as that on the working test site.
I have confirmed that the file permissions and ownership are correct on the live site.
I have confirmed that I can put another (Magento supplied) widget in the exact spot on the configurable product page (Product Extra Info). So I know that my templating, etc. is not getting in the way of adding the widget in that spot.
I've tried deleting the widget instance and recreating a new instance of the same widget.
I have compared the code to the test site and copied the code straight from the test site. Still no success. I have enabled php_flag display_errors in .htaccess and no errors are shown. And no errors are showing in the exception.log when enabled.
The live and test systems are on different servers, different OS's, different versions of PHP (both 5.3.x). I've refreshed all the caches and confirmed that the test widget is showing so I don't think this is a caching issue.
How is the best way to confirm that Magento on the live site can actually access or find the Block code for my widget? As indicated I know Magento is accessing the widget.xml file in my local code directory. Not sure if installing Alan Storm's CommerceBug is the way to trace or dump what Magento is trying to load (modules, widgets, etc) for the page in question.
Verify that you have your xml in the /app/etc/modules folder.
You can turn on Block Hints by going to Admin->System->Configuration->Advanced->Developer, change the Current Configuration Scope to Main Website and click on Debug. Change Template Path Hints to Yes and save.
Verify your filenames. This has gotten me a number of times. I develop on a Mac (non case-sensitive), and occasionally when I upload to Linux (case-sensitive), it breaks. One of the first thing I check is the file name's case.
Ensure that the class name matches the filename.
The next step I'd take is to take a look at the final page layout xml generated for the page your'e adding the widget to and ensure a bit of Layout XML is being added to the page for your widget. If it isn't, there's something wrong with the Layout XML Updates that are added to the table via the widget UI. If it is, then start debugging why the particular chunk of generated layout XML isn't being added to the page.
This is the top-down approach to debugging the problem, but it's the only way I know to be sure.
I had the same problem. It's my decision:
app\code\local\Mage\Core\Model\Resource\Layout.php
When 'theme' => Mage::getSingleton('core/design_package')->getTheme('layout') result is not correct: 'theme' => 'multistore', should be 'theme' => 'your_theme'.
So, delete argument 'layout' in function getTheme() and get right result
*/
class Mage_Core_Model_Resource_Layout extends Mage_Core_Model_Resource_Db_Abstract
{
...
public function fetchUpdatesByHandle($handle, $params = array())
{
$bind = array(
'store_id' => Mage::app()->getStore()->getId(),
'area' => Mage::getSingleton('core/design_package')->getArea(),
'package' => Mage::getSingleton('core/design_package')->getPackageName(),
// 'theme' => Mage::getSingleton('core/design_package')->getTheme('layout')
'theme' => Mage::getSingleton('core/design_package')->getTheme()
);
foreach ($params as $key => $value) {
if (isset($bind[$key])) {
$bind[$key] = $value;
}
}
$bind['layout_update_handle'] = $handle;
$result = '';
$readAdapter = $this->_getReadAdapter();
if ($readAdapter) {
$select = $readAdapter->select()
->from(array('layout_update' => $this->getMainTable()), array('xml'))
->join(array('link'=>$this->getTable('core/layout_link')),
'link.layout_update_id=layout_update.layout_update_id',
'')
->where('link.store_id IN (0, :store_id)')
->where('link.area = :area')
->where('link.package = :package')
->where('link.theme = :theme')
->where('layout_update.handle = :layout_update_handle')
->order('layout_update.sort_order ' . Varien_Db_Select::SQL_ASC);
$result = join('', $readAdapter->fetchCol($select, $bind));
}
return $result;
}
}