CakePHP 3 change locale input date - date

I have the following input date on form:
echo $this->Form->input('fecha_limite', ['label' => __('Fecha límite'), 'type' => 'date', 'class' => 'form-control']);
By default the months are shown on english locale and I want to establish spanish locale.
I have tried to change it using intl.default_locale since config/bootstrap.php and using I18n::locale() and doesn't works...
Any ideas?

this problem probably has some Reason.cakephp 3 has cache for i18n therefore you must delete cache .maybe you was a mistake in file locale.you have to don't use of two line in that file.
However maybe because of use form helper.please test outside form helper

Related

Thousand separator in symfony input form

I have in my symfony5 form input
->add('required_amount', IntegerType::class, [
'label' => 'Požadovaná částka',
'grouping' => true,
]);
when run form the thousand sepator isn dispaly on typing number
whatis wrong in my code, may I use number format in input in form in symfony
I copy your code and runs just fine to my 4.4.4 symfony project. If you submit this form the output will be 1,000,000 or 1.000.000 depending on your locale value default set in .env file. The grouping property is in IntegerType , MoneyType and NumberType and do the same in all this classes , so this is not your problem. If you describe something in client side (as you type the numbers to add the separator) you need to go with javascript not php, but i don't thinks this is the case.

How can I make form fields / messages available for given locale in Symfony 4?

I created a form in Symfony 4:
$form = $this->createFormBuilder($item)
->add('username', TextType::class, array('attr' => array('class' => 'form-control')))
But now I get an error message for username.
These messages are not available for the given locale and cannot be
found in the fallback locales. Add them to the translation catalogue
to avoid Symfony outputting untranslated contents.
So I installed Symfony translation via composer, I still cannot find the "catalogue" and also why do I need to add this to a catalogue if I only have one language
In the Profiler you can see which catalogue symfony is looking for. normally validation is found in the validators catalogue, which means you need to add a validators.LOCALE.yml (locale must be the locale you are using ex. en) in the translations folder. But look up the right catalogue!

Custom date field in woocommerce only years?

I have created a custom field in woocommerce where i want shopowners choose a year of publishing (books in this case).
So far i have:
//Custom Product Date Field
woocommerce_wp_text_input(
array(
'id' => '_custom_product_date_field',
'placeholder' => 'Publicatiedatum',
'label' => __('Publicatiedatum:', 'woocommerce'),
'type' => 'date',
'date-type' => 'years'
)
);
How can i set the date-type to years, as the last key => value (date-type:years) is not working?
I was curious since I was looking for details on using the date field in a woocommerce custom field. I didn't need year only specifically but it was an interesting rabbit hole to run down.
Trying to understand a bit more how woocommerce_wp_text_input creates these fields it started to become more apparent that supplying the type attribute simply passes it on to the HTML attributes. That said, these are standard HTML elements, not a wrapper of sorts that produces more fancy fields utilizing things like jQuery which seems like what the OP was expecting.
Looking over the specs for the date-related HTML text input fields it becomes apparent that there is not an <input> of type="year" available in the spec. We are limited to the type's specified in the specs.
I was able to successfully create a month input with the following:
woocommerce_wp_text_input(
[
'id' => '_my_month',
'label' => __('My month', 'woocommerce'),
'value' => get_post_meta($post->ID, '_my_month', true),
'type' => 'month',
'custom_attributes' => [
'min' => '2020-01',
],
]
);
So understandably, from what I can see, doing what you are asking isn't possible unless the HTML specifications add a year input or woocommerce provides a bandaid when specifying type as year. Hopefully this better explains how woocommerce_wp_text_input expects the data to be formatted and what is really supported.
As an aside that might assist in completing the requirements of the original question through alternate means, you could attempt to implement a jQuery UI picker which supports year only. I however feel that the jQuery UI picker using year only is a bit clumsy being it provides a popup to simply choose a date from a dropdown AND the left/right pagination of the popup still pages through months while showing only years. You might as well just use a dropdown or a number field with the date min/max values you require, both have example code that can be seen in other answers on that aforementioned answer I linked.

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'),
.....

TinyMCE in impresspages plugin trouble

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