TinyMCE in impresspages plugin trouble - plugins

At first, it is need to know I get active the FullTinyMCe and TinyMCEComplete plugins in Impresspages. Well, I have a new plugin where I have a field like this:
$fields[] = array(
'label' => 'Rich Text to Store',
'field' => 'textToStore',
'type' => 'RichText',
'preview' => '\Plugin\MyPlugin\Helper::previewText'
);
How do I do to force the type RichText using the versatility of the FullTinyMCE instead of internal configuration? I need other skills in this field like html edit and save for instance.
Thanks for the aid!

These plugins alter the config just for themselves. If you want to update TinyMCE globally, change the implementation of ipTinyMceConfig() function. This is the default function that provides the configuration of TinyMCE. Replace it with your own function (this is all about JavaScript) that returns your custom configuration. That will take affect everywhere on ImpressPages. More about that:
https://www.impresspages.org/docs/tinymce

Related

TYPO3 EXT:cart_product: extend backend with one selection to do conditional theming in template

I'm looking for a way to extend the backend of the TYPO3 extension cart_products with one additional select field. I have already created some different ViewHelpers for the ProductBackendVariants and now need a way to choose the corresponding Viewhelper.
Best would be if there is a selection direct after the type select in the general product type. But I am not able to add some additional configuration fields to this tab.
Already added
'formtemplate' => [
'label' => 'ProductDetail Variant Form',
'config' => [
'type' => 'select',
'renderType' => 'selectSingle',
'items' => [
['Standard', 1],
['Matten', 2],
['Zaunpaket', 3],
],
'size' => 1,
'minitems' => 1,
'maxitems' => 1,
],
],
to the tx_cartproducts_domain_model_product_product.php but nothing appears in the backend.
I don't know that specific extension but some hints in general:
it seems that you have tried to modified the TCA directly in the extension (cart_products/Configuration/TCA/tx_cartproducts_domain_model_product_product.php). You should never change anything in a 3rd party extension (neither the TYPO3 core) because you loose the ability to update.
You need to create your own extension and add a file to Configuration/TCA/Overrides. Ideally you name the file exactly like the file you like to extend for easier understanding. See the documentation for details.
To add a new field to the TCA you not only need to define the name and type but you also need to create the database field. That's done in ext_tables.sql of your custom extension.
It's not sufficent to create the TCA config and SQL mentioned above you also need to tell, where the new field should be visible in the backend. That's done with the showitem setting. See documentation for details.
To ease the process of extending an existing TCA I can recommend the extension TCA Builder which makes it in many cases much easier to create the TCA code. See these examples how that's done. Nevertheless you need to create ext_tables.sql.
Last but not least: when you made changes to ext_tables.sql you need to run the database compare in the TYPO3 install tool.

How to pass params in url to a backpack create form

I'm using backpack 3.3 on a laravel 5.5 installation.
I want to prefill two create form fields with two URL passed values.
Say you create a basic backpack crud, named Image.
Normally you can go to domain/admin/image/create to view and fill in the form.
But if I add one or two params in the url, I get a 404.
I guess I should manage the routes file (admin.php)
I tried this way:
Route::group(['prefix' => 'image/{k}/{cid}'], function()
{
CRUD::resource('image', 'ImageCrudController');
});
but still get a 404.
Any suggestions?
Thanks in advance.
Almost all field types have a default option. So when you define them, you can specify a default. And you can always pass a GET parameter for that default. So you can have something like this in your EntityCrudController:
$this->crud->addField[ // Text
'name' => 'title',
'label' => "Title",
'type' => 'text',
'default' => \Request::has('title')?\Request::has('title'):false, // default value
]);
You'd then be able to send you users to yourapp/admin/entity/create?title=your+default+value and have that default value show up in the field.
Hope it helps. Cheers!
it works for me easier
http://127.0.0.1:8000/admin/resultado/create?competencia=2
$this->crud->modifyField("competencia_id",[
'label' => "Competencia",
"default"=>$this->crud->request->query->get('competencia'),
.....

Additional page property fields in TYPO3 CMS 6.2

What would be the recommended method to add custom page property fields in TYPO3 6.2?
In 4.5 I used TemplaVoila which had its own page module and made it easy to add data records on a page level.
There are several approaches:
The "vanilla" approach:
Create an extension (and with it the file ext_emconf.php) and then create a file ext_tables.sql in the extension root. In it you can put SQL-definitions for the new fields, by defining a CREATE TABLE statement for the pages table:
CREATE TABLE pages(
myNewField int(11) DEFAULT '',
);
This SQL-definition will be merged with existing definitions for the table page.
Then you need to configure the new field in the Table Configuration Array (TCA). You can usually find good examples in existing extensions, for example in realurl. There are two places where you can put these definitions, either in the file ext_tables.php (uncached), or into a php file in the folder Configuration/Tca/Overrides (cached).
This approach sounds like more work than it actually is.
Just use TemplaVoila. It is available for TYPO3 6.2, but its future is uncertain, AFAIK.
Use the fluidtypo3-Ecosystem of extensions, and especially the extension fluidpages. It does what you want, in a similar way to TemplaVoila, but with modern (= fluid-based) technologies.
if you need your own custom content elements, i recommend the extension "DCE" (Dynamic Content Elements).
DCE is really easy to customise and you can create Content elements in some minutes.
Also you can do it like Jost said. Do it with an own extension and put the TCA definition in your extTables.php
As example:
/www/htdocs/website/typo3conf/ext/custom_extension/ext_tables.php
$tmp_itm_extended_columns_pages = array(
'link_class' => array(
'exclude' => 0,
'label' => 'LLL:EXT:itm_extended/Resources/Private/Language/locallang_db.xlf:label.linkClass',
'config' => array(
'type' => 'select',
'items' => array(
array('Nichts', ''),
array('Zahnrad', 'icon-afford', 'EXT:custom_extension/Resources/Public/img/icons/icon_preferences_small.png'),
array('Fabrik', 'icon-factory', 'EXT:custom_extension/Resources/Public/img/icons/icon_factory_small.png'),
array('Computer', 'icon-software', 'EXT:custom_extension/Resources/Public/img/icons/icon_software_small.png'),
array('Person', 'icon-jobs', 'EXT:custom_extension/Resources/Public/img/icons/icon_person_small.png'),
array('Welt', 'icon-world', 'EXT:custom_extension/Resources/Public/img/icons/icon_world_small.png'),
array('Rohre', 'icon-pipe', 'EXT:custom_extension/Resources/Public/img/icons/icon_pipe_small.png'),
),
),
),
);
Then you have to add your new field to the ext_tables.sql
#
# Table structure for table 'pages'
#
CREATE TABLE pages (
link_class text
);

Typo3 override backend classes

It's been a few weeks I work on Typo3 6.2 and I want to know how to override Typo3 Core classes.
In my case, I have to edit the way select html objects are displayed (I want to add optgroup but Typo doesn't allow us to do it). So I edited the file "FormEngine.php" (typo3/sysext/backend/Classes/Form) and now it works.
But this isn't healthy for future upgrade.
Is there a way to override core classes like any other CMS would allow us to do ?
And I haven't been able to find something on the Internet and I think it could be useful.
Thank you :)
Zisiztypo
Instead of modifying source code of CMS you can just declare a field with a user type and then point your custom userFunc
From the ref:
'tx_examples_special' => array (
'exclude' => 0,
'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:fe_users.tx_examples_special',
'config' => array (
'type' => 'user',
'size' => '30',
'userFunc' => 'Documentation\\Examples\\Userfuncs\\Tca->specialField',
'parameters' => array(
'color' => 'blue'
)
)
),
TIP: Using this approach, you can create ANY type of field you need, it can be i.e. Google Maps selector, set of fields with common dependencies filled by JS, etc, etc.

Add a dropdown list as custom field in magento

I added custom fields as described in magento add custom input field to customer account form in admin
But I want a select list, not only a text input one. I don't know which kind of parameter I have to set and how to tell the list of possible values.
Please help :)
Thanks,
Plantex
Where you might do something like:
$setup->addAttribute('customer', 'custom_attribute', array(
'type' => 'text',
'label' => 'Customer Custom Attribute',
));
Use these values instead:
$setup->addAttribute('customer', 'custom_attribute', array(
'type' => 'int',
'label' => 'Customer Custom Attribute',
'input' => 'select',
'source' => 'eav/entity_attribute_source_boolean',
));
The type is int because you will typically be storing the index of the value chosen, not the value itself. The input is select so the admin renderer knows which control to use. The source shown here is a common example, it provides an array of "Yes" and "No" values with numeric indexes.
There are many source models already in the Magento code that you can use and you can create your own too, look at any existing one to see how it returns an array. If you make your own and if it uses text indexes instead of numeric then the type will have to be changed back to text.
Try adding this at your module setup file
'value' => array('notate_to_zero'=>array(0=>'Bleu',0=>'Rouge',0=>'Vert',0=>'Violet',0=>'Noir',0=>'Orange'))
),
or look at this --> http://inchoo.net/ecommerce/magento/how-to-create-custom-attribute-source-type/