I want for all my entity properties type "text" to show a html editor(preferably tinyMCE) in the forms to create and edit.
Is there any way to do it?
I'm not sure if the text input is the best way (and possible) to represent your text editor over the textarea element using TinyMCE. Here it goes how you do it:
->add('myText', 'textarea', array('attr' => array('class' => 'tinymce', 'tinymce'=>'{"theme":"simple"}')));
You can later include TinyMCE dependencies by adding a custom template for this field with its template option (although it would be recommended to add them inside the <head> of the page)
hi first install tinycme editor bundle in your project for this please see this page
after that for using in sonata admin see this issue
Related
I would like to add a link to the contextual links on a view block. Currently there's the "modify view" and "translate view" links.
Isn't there a way to inject it in the myTheme.theme file ? Like a preprocess ? I looked in the preprocess_view_view and there's only this in the title_suffix :
"contextual_links" =>
"#type" => "contextual_links_placeholder"
"#id" => "entity.view.edit_form:view=promotions:location=block&name=promotions&display_id=block_1&langcode=fr"
I want to add "Sort" that links to "/admin/sort/promotions".
I searched a bit and all I see is solutions talking about creating a custom module. I tried but it's way over my head with the routing and all... I just don't get it. Seems I would need to learn Drupal 8 inside out just to add that link.
I would be very thankful if somebody might help me with some stuffs about CKEditor on symfony ( sylius e-commerce project ).
Things I want to do are:
I am wondering how I could replace standard textarea on my sylius admin dashboard panel with ckeditor textarea? For example
I want to replace that standard textarea with advanced text area using ck editor..
so if somebody might help me I would be really thankful.
I solved this on next way :
1) EDIT FILE "StaticContetType.php", find a textarea and edit it on a this way:
->add('body', CKEditorType::class, [
'required' => false,
'label' => 'sylius.form.static_content.body',
])
and u get rich ckeditor textarea instead of that simple one =)
just insert this in your backend layout view..
<script src="//cdn.ckeditor.com/4.5.10/standard/ckeditor.js"></script>
<script>
$('textarea').each(function() {
CKEDITOR.replace($(this).attr('id'));
})
</script>
I'm creating a custom drupal 7 theme
<?php print theme('links', array('links' => menu_navigation_links('menu-headermenu'), 'attributes' => array('class'=> array('links', 'headermenu')) )); ?>
Above is the code I'm using in my theme to show a menu I created using the Admin section.
My problem is the menu is getting displayed only for the Admin.
I want it to be shown to anonymous as well as registered users.
Also, I've tried changing the role permission by ticking 'Administer Block' and 'Administer menus and menu items' to all the three kind of users. Nothing helps.
Please help me..
I'm not 100% sure this will answer your question, because it side steps the code above - but, you could try enabling the Menu Block module, then using it to create a block based on your desired menu. Then you can place it any block region, and control it via the normal block controls.
The only trick of it is you might need to add a region to your template if it doesn't exist in the place that you want, but that's easy.
I would like to add a field / column to the Content Administration Overview page but it appears the easiest theme override to do this has been deprecated with D7.
In D6 I could just override the method:
theme_node_admin_nodes($form)
But this method no longer exists for D7. What's the equivalent replacement or do I actually need to hook into node_admin_nodes() now and modify the form directly?
For me it was super easy with these two modules:
views bulk operations (VBO)
administration views (needs VBO)
As soon as both modules are installed and activated you can go to your views (admin/structure/views) where now 3 additional views appear (Administration comments, Administration nodes, Administration users). You then just need to edit the view "Administration nodes", where you can add and arrange everything you want as usually with views.
I wanted to add a column displaying all content's nids. Worked super well!
You'll have to hook into the form, the theme element has been completely removed node_admin_nodes() in Drupal 7.
It's actually node_admin_content() that you'll need to hook into as node_admin_nodes() is no longer a form function, it just builds up elements that are used by node_admin_content().
Fortunately the elements in node_admin_nodes() and node_filter_form() (the two functions used in node_admin_content() to build up the page) are nicely structured and will be very easy to override.
I've been able to add an element to the bottom of the table. Although I am unsure how you ADD a coloumn into the body of the table?
function seven_form_alter(&$form, &$form_state, $form_id) {
drupal_set_message("Form ID is : " . $form_id);
//get node_admin_content
//$nodeAdmin = drupal_get_form("node_admin_content");
// Add a checkbox to registration form about agreeing to terms of use.
$form['node_admin_content']['poland'] = array(
'#type' => 'checkbox',
'#title' => t("I agree with the website's terms and conditions."),
'#required' => TRUE,
);
}
The Administration Views module replaces a lot of admin listings with real views (as in Views module) that you can edit and configure any way you want it.
I have a custom form that I have written with the Form API. We have the WYSIWYG module and TinyMCE implemented on the site that this module will be used on. How do I implement the WYSIWYG api on my custom form text areas?
Thanks!
This should help integrate WYSIWYG with your custom module forms: http://drupal.org/node/358316
Basically, you need to add the format key to each of your form fields and use filter_form()
Just in case anybody working with Drupal 7, here's the link to it that should help integrate WYSIWYG TinyMCE with your custom form fields: http://drupal.org/node/1087468
Thanks
In case you are working in drupal 7. Use the following.
$form['FIELD'] = array(
'#type' => 'text_format',
'#title' => t('TITLE'),
'#format' => 'full_html' //the format you used for editor.
);
In your form submit handler, you can access the value as follows.
$form_state['values']['FIELD']['value'];