I'm developing with backpack for laraver and I'm using wysiwyg field. I would like to use underline and change font color. I'm searched in ckeditor webpage and it seems it supports these functions.
How can I enable them?
Best regards
Edit - I don't understand why I'm receiving negatives for this question. What I'm doing wrong?
Edit 2-
Thank you Delighted,
Here is the code I'm using, but forecolor option seems not to be working. The button does not appear.
$this->crud->addField([
'name' => 'desc1',
'label' => 'DescipciĆ³n 1',
'type' => 'tinymce',
// optional overwrite of the configuration array
'options' => [
'selector' => 'textarea.tinymce',
'skin' => 'dick-light',
'plugins' => 'image,link,media,anchor',
'toolbar' => 'undo redo formatselect fontsizeselect bullist numlist link image bold italic underline forecolor',
],
]);
What you are looking for is the options index in the field configuration which is documented here
Essentially, you'll want to include the options index in your field configuration and add to it any of the options that you would normally pass to the javascript init method of TinyMce if you were using it manually.
The specific option you want is the toolbar option. Here's a list of controls you can add to the toolbar
Here's a quick example:
$this->crud->addField([
'name' => 'description',
'label' => 'Description',
'type' => 'tinymce',
// optional overwrite of the configuration array
'options' => [
'selector' => 'textarea.tinymce',
'skin' => 'dick-light',
'plugins' => 'image,link,media,anchor',
'toolbar' => 'forecolor underline',
],
]);
For a closer look at exactly how these options are passed to tinymce, see the tinymce field blade template lines 33 - 50
I have finally got that. I had to add textcolor and colorpicker as plugins.
The resultant code is as follows.
$this->crud->addField([
'name' => 'desc1',
'label' => 'DescipciĆ³n 1',
'type' => 'tinymce',
// optional overwrite of the configuration array
'options' => [
'selector' => 'textarea.tinymce',
//'statusbar' => false,
'skin' => 'dick-light',
'plugins' => 'image,link,media,anchor,textcolor,colorpicker',
'toolbar' => [
'undo redo | styleselect | bold italic | link image | forecolor',
'alignleft aligncenter alignright'
]
],
]);
Thank you very much Delighted00
Related
I've got some trouble with creating repeater responsive margin control in my Elementor widget. I dynamically create items in the widget and I need this field to be able to change the position of my items in the widget.
My code below doesn't work.
// Content section
$this->start_controls_section(
'content_section',
[
'label' => __( 'Content', 'watt-elements' ),
'tab' => Controls_Manager::TAB_CONTENT,
]
);
...
$repeater = new \Elementor\Repeater();
$repeater->add_responsive_control(
'feature_margin',
[
'label' => __( 'Feature margin', 'plugin-name' ),
'type' => \Elementor\Controls_Manager::DIMENSIONS,
'size_units' => [ 'px', 'em', '%' ],
'selectors' => [
'{{WRAPPER}} {{CURRENT_ITEM}} .feature-tip' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]);
...
$this->end_controls_section();
I know it is a late reply but should be helpful for someone.
You need to add the below dynamic class for {{CURRENT_ITEM}}.
class="elementor-repeater-item-<?php echo $item['_id']; ?>"
Cake3.6:
I am validating a form field which allows multiple files to be uploaded:
$this->Form->input('listing_images. ', ['type' => 'file', 'multiple' => 'multiple']);
I have a custom validation provider which correctly validates the multiple images:
$validator ->add('listing_images', 'listing_images', [
'rule' => [
'dimensions', [
'min' => ['w' => 100, 'h' => 100],
'max' => ['w' => 1600, 'h' => 1600]
]
],
'message' => 'Maximum image size is 1600 x 1600 pixels',
'provider' => 'custom'
]);
The problem is that when validation fails the validation error does not appear below the field. If make the file upload single file only and name is 'listing_images' the validation error does appear.
Why does it not work for multiple?
While it may work partially, the trailing dot syntax that you are using isn't supported (and the trailing space only makes things worse), the form helper will not be able to find the field based on that name.
You can use the name option to specify a name with trailing brackets as required for a multiple file upload HTML input, while passing the regular field name that the form helper understands:
echo $this->Form->control('listing_images', [
'type' => 'file',
'name' => 'listing_images[]',
'multiple' => 'multiple',
]);
I created a custom entity with an image field. But I can not display the alt and title fields.
Here is my code:
$fields['main_img'] = BaseFieldDefinition::create('image')
->setLabel(t('Main image of the hardware'))
->setSettings([
'file_directory' => 'hardware',
'file_extensions' => 'png jpg jpeg',
])
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'image',
'weight' => -30,
))
->setDisplayOptions('form', array(
'label' => 'above',
'type' => 'image_image',
'weight' => -30,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
Could you tell me how to display the alt and title fields of my image and maybe someone knows where the documentation is for doing that because I can not find it?
Thank you all
I loaded one of my node field definitions with $node->getFieldDefinitions():
I believe you can try something like this:
->setDisplayOptions('form', array(
'label' => 'above',
'type' => 'image_image',
'weight' => -30,
'settings' => [
'alt_field' => TRUE,
'alt_field_required' => TRUE, //optional
'title_field' => TRUE,
'title_field_required' => TRUE, //optional
],
))
Thank Dmytro.
I feel a little stupid but it's life.
It was enough to add 'alt_field_required' => FALSE and 'title_field' => TRUE in setSettings.
But as title and alt is displayed that when we download an image I thought it did not work.
A day of lost!
How to remove content limit from grid column.i have long text to display it in grid but when display it subtract the string.i want to show full text in the grid.
Ok Found solution just add string_limit in addcolumn or addColumnAfter function in grid.php
$this->addColumnAfter('addons', array(
'header' => Mage::helper('sales')->__('Addons'),
'filter' => false,
'sortable' => false,
'index' => 'addons',
'type' => 'text',
'string_limit' => '500', /* added for content limit */
), 'billing_name');
I'm trying to write a custom action to run off of an admin grid that I have built. Is it possible to send a value from a column in the grid to the controller via either get or post?
I've tried googling, but I cannot find a proper explanation for this anywhere. A link to an explanation of the column settings ('getter', 'type' etc.) would also be useful if this is available.
Add this code to your Grid.php:
$this->addColumn('action',
array(
'header' => Mage::helper('yourmodulename')->__('Action'),
'width' => '100',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'caption' => Mage::helper('yourmodulename')->__('Edit'),
'url' => array('base'=> '*/*/edit'),
'field' => 'id'
)
),
'filter' => false,
'sortable' => false,
'index' => 'stores',
'is_system' => true,
));
That will build an "Edit" URL with the Id of the selected row as part of the URL. It will look something like <frontname>/<controllername>/edit/id/<value> where value is returned by the getter getId().
The getter field will execute any of the standard Magento magic getters, ie any attribute is gettable. So you could have getName or getProductUrl or getIsLeftHanded if you wanted and your controller can parse the attribute.
The controller can then retrieve that passed value using Mage::app()->getRequest()->getParam('attributename');
In terms of documentation/tutorials, have a read of this article on the website of #AlanStorm as it might help.
HTH,
JD