I've created this simple plugin and it removes admin links menu from admin panel.
<?php
/*
Plugin Name: admin menu remover
Description: Remove the admin menus just by a single plugin installation
Version: 1.0
Author: Author
Author URI: http://URI_Of_The_Plugin_Author
License: A "Slug" license name e.g. GPL2
*/
function remove_links_menu() {
remove_menu_page('index.php'); // Dashboard
remove_menu_page('edit-comments.php'); // Comments
remove_menu_page('themes.php'); // Appearance
//remove_menu_page('plugins.php'); // Plugins
remove_menu_page('tools.php'); // Tools
remove_menu_page('options-general.php'); // Settings
remove_menu_page('users.php'); // Users
}
add_action( 'admin_menu', 'remove_links_menu' );
?>
It removes 6 menus instantly after the installation. 1 line (plugins) is commented out.
Now I want to add setting option to the plugin where the user would be able to select which menu should be removed.
There should be a check box on the plugin setting where we can select which menu should be shown and hidden.
you can save the options in the _options table using update_option( $option, $new_value )
then you can use get_option( $option, $default ) to read the value from the database.
You'll have to be a little carefull when naming your option so it won't conflict with other options names (use of a prefix should fix this)
Related
Shortly, i needed to help a good friend, to move her complete typo3 install to another provider.
There was no chance in getting help from the developer at all.
I exported and imported the tables
downloaded all of the folder and uploaded it again
I set new InstallTool Password and added new Administrator
I updated the MySQL-Connection
Now everything seems to work correctly, BESIDES an error calling at the top of the page (where the language selection is supposed to be) saying:
ERROR: Content Element type "sr_language_menu_pi1" has no rendering definition!
For now, I tried to hide this annoying layer with CSS-property display none ;)
But it's a website where I need to have multiple languages enabled.
I have no experience with typo3, so please describe possible solutions as simple as possible.
This error happens e.g. under TYPO3 6.2.17.
You must have a sysfolder called "Templates" where you create a new extension template setup for the extension sr_language_menu. (Template Module)
Use the title "+ext sr_language_menu".
There you enter a constants part like this:
plugin.tx_srlanguagemenu {
addSelectionListHeader = 0
showCurrentFirst = 0
defaultLanguageISOCode = DE
hideIfNoAltLanguages = 1
showInactive = 0
pointerImage =
defaultLayout = 0
addLinksListHeader = 0
doNotLinkCurrent = 1
separator =
token = |
selectionListSeparator =
showCurrent = 1
useIsoLanguageCountryCode = 1
}
And you enter a setup like this.
plugin.tx_srlanguagemenu {
_CSS_DEFAULT_STYLE >
flags.stdWrap.split.wrap = <ul id="langmenu">|*| | |*| |</ul>
flag.NO.stdWrap.wrap = <li>|</li>
flag.INACT.stdWrap.wrap = <li>|</li>
flag.CUR.stdWrap.wrap = <li>|</li>
links.stdWrap.split.wrap >
}
Then go to the tab "Include static (from extensions):" and set the
Selected Items to
"Language Menu setup (sr_language_menu)" and
"Language Menu CSS Styles (sr_language_menu)"
Then go to your main template setup. (Template Module).
Edit Template "Main Template" on page "..."
Go to the tab "Includes" and add the "+ext sr_language_menu". to "Include Basis Template:". You can use the page browser in the new popup window to navigate to the Templates folder and select the record with the template name "+ext sr_language_menu".
Then you must install static_info_tables 6.2.1 or higher, and install the country specific static_info_tables extensions. Deinstall sr_language_menu and reinstall it again. Then open the Extension Manager an see the green round arrow symbol "Execute the update script".
Afterwards the error message has gone and the language menu shows up.
You can see if the templates of this extension is present on the project installation.
Might be you din not include static from template of "sr_language_menu"
Go to Web > Template > Root page
Info/Modify: edit whole template
Something like: http://screencast.com/t/jq3rggQy
cheers,
Ghanshyam
In the context of a custom CMS, I have replaced the default 'Link' and 'Image' buttons with my own dialogs and commands to be able to link to existing CMS pages and files by selecting them from my custom dialogs.
In older versions of CKEditor, there was no ACF, so this was no problem.
In 4.1+, if I do not include the original 'Link' and 'Image' buttons, the results from my new buttons get filtered by the ACF. The plugins themselves work just fine, but I can't figure out how to get the ACF to automatically allow links and images.
* I AM NOT INTERESTED IN DISABLING THE ACF *, I just want the plugins to behave.
Example toolbar configuration that allows my buttons (LinkContent, ImageSelect, and FileSelect) to work:
{ name: 'links', items : [ 'Link', 'LinkContent', 'Image', 'ImageSelect', 'FileSelect' ] }
If I use the following, the content from my buttons is filtered out:
{ name: 'links', items : [ 'LinkContent', 'ImageSelect', 'FileSelect' ] }
In my plugin definitions, I have added what I thought was the appropriate ACF settings. In my ImageSelect plugin file:
CKEDITOR.plugins.add('imageselector', {
init: function( editor ) {
editor.addCommand( 'imageselectorDialog', new CKEDITOR.dialogCommand ( 'imageselectorDialog', {
allowedContent: 'img[alt,!src]{width,height}',
requiredContent: 'img',
exec: function( editor ) {
...
Would love to find out how to correct this without having to include the default buttons alongside my own.
Okay, so my solution is actually correct. As has been the case with most CKEditor frustrations, the reason it looked incorrect is because CKEditor tends to be very persistent with its caching (* not actually cached by CKEditor -- see comments below).
After my changes were pulled into someone else's checkout, the plugins worked perfectly.
Lesson -- Completely clear your cache with EVERY change when trying to debug CKEditor problems.
EDIT -- clarified that caching is not done by CKEditor because someone complained.
I have correctly configured MoxieManager to be integrated with TinyMCE and all works fine. But I'd like to remove the "browse" button (which opens the MoxieManager dialog) from the "Insert link" dialog.
So from the following screenshot, the green should stay but the red should go.
Self answer, but I guess it will be helpful to other people as well.
Each TinyMCE plugin usually has a JS file located under plugins/[plugin_name]/plugin.js (or plugin.min.js, depending on if you are using the minified version). Those plugins usually call the editor.windowManager.open(), passing an object of configuration options to be applied to the newly opened window.
One of the values this object can have is body which is an array of the items to be displayed in the dialog. Each item has some options to be configured on its own, including the type property.
In the below example, I have used plugins/link/plugin.js to show the difference needed to replace the (default) text field with the file browser button - with the standard text field without the browse button.
win = editor.windowManager.open({
// ...
body: [
{
name: 'href',
type: 'filepicker',
filetype: 'file',
// ...
},
// More code follows here
And the new version:
win = editor.windowManager.open({
// ...
body: [
{
name: 'href',
type: 'textbox',
filetype: 'file',
// ...
},
// More code follows here
Or, if you don't want to change the source .. say you're using a minified version etc, you can disable it via CSS:
div[aria-label="Insert link"] .mce-btn.mce-open {
display: none;
}
add it to you config
file_picker_types: 'media image'
file_picker_types
This option enables you to specify what types of file pickers you need
by a space or comma separated list of type names. There are currently
three valid types: file, image and media.
https://www.tiny.cloud/docs/tinymce/6/file-image-upload/#file_picker_types
I have set up an extbase extension in a TYPO3 4.5 site with the extension builder, containing just the default listAction in the controller.
Now I would like to add a new Action, and it doesn't work.
I don't need (aka. can't get to work) a flexform to choose the controller action.
As there's a field "Plugin mode", I thought I could just manually enter the action here:
And extend the plugin configuration as such in ext_localconf.php:
Tx_Extbase_Utility_Extension::configurePlugin(
$_EXTKEY,
'Pluginname',
array(
'Controllername' => 'list,listfeatured',
),
);
Also, in the controller, I have added a new action.
/**
* action listfeatured
*
* #return void
*/
public function listfeaturedAction() {
// do something
}
But, alas, the action is not called at all.
Did I interpret the field "plugin mode" wrong?
Did I miss something?
Alternatively: Can I set the action for a "backend" plugin via TS as well?
You need to use FlexForm correctly to set list of switchable actions.
Other option is creating another plugin for which default action is listfeatured.
If you will decide to use single plugin only just you need to show/describe us what did you try in FlexForm (probably new question)
Edit: As you showed us yourself in your question it's you deciding which Controller and action are default for given plugin, so to add new plugin which will use existing controller, just add this to your ext_localconf.php
Tx_Extbase_Utility_Extension::configurePlugin(
$_EXTKEY,
'MyFeaturedPlugin',
array(
'Controllername' => 'listfeatured',
),
);
you may also need to registerPlugin in your ext_tables.php if you want to be able to use it in BE (can be ommited if ie. plugin should be placed only with TS). You will do this with: Tx_Extbase_Utility_Plugin::registerPlugin
Besides FlexForm there is a further way of reading the field Plugin Mode in the plugin with PHP.
Right now, I'm working on a plugin and wish to distinguish between modi. Some modus B should be set from the very beginning of the request, even better it should not be sent over HTTP but read from the data model.
So I set the text 'myModusB` in the field "Plugin Mode", and in the plugin I inspect:
exit (print_r($this, true));
Then I find
[cObj] => TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer Object
...
[data] => Array
(
...
[select_key] => myModusB
...
So in the plugin by writing
$modus = $this->cObj->data["select_key"];
I'll get the text and can process it.
This is tested for version 6.1.3.
I have added a custom LabelDecorator to an Eclipse 3.6, which replaces the cryptic usernames added by the SVN Team Text Decorations. The SVN Team Decorator allows you to add an author tag. What I did was adding another Decorator replacing these author strings (which are company specific shortnames with numbers) with the actual name of the user.
While SVN Team Text Decorations extends the Package Explorer with:
... com.company.package · XY9723 · [30.02.11 19:11]
I replace that by
... com.company.package · Neil Diamond · [30.02.11 19:11]
Now, to complete the mission, I added a preference page, where users are able to specify the attributes (name, forename, birthdate, company name, telephone, etc.), which should be used as replacement. I'd like to update the package explorer (or whereever svn team decorates ressources) with the newly selected attributes whenever "Apply" or "Ok" is pressed.
At the moment the ressources are only updated after you have pressed "Apply" or "Ok" and manually collapse/expand one of the ressource in the explorer.
Is there some event I could fire?
Use the IDecorationManager interface:
IWorkbench workbench = ...;
IDecoratorManager manager = workbench.getDecoratorManager();
inside of the prefernce pages LabelProvider:
ILabelDecorator decorator = manager.getLabelDecorator("com.plugin.mydecorator");
if(decorator != null){ // decorator is enabled
LabelProviderChangedEvent event = new LabelProviderChangedEvent(demoDecorator);
// update specific resources
fireLabelEvent(event, arrayOfResourceToUpdate);
// or update all resources
fireLabelEvent(event);
}
-> see Understanding Decorators
without a LabelProvider
manager.update("com.plugin.mydecorator");
-> see DecoratorManager.java