Label for sonata admin embedded add button - sonata-admin

Is there a way to change the label for 'Add new' buttons when embedding collections in sonata admin? I have a couple of nested forms and the buttons are confusing for the user to say the list

Copy file sonata-project/admin-bundle/Resources/translations/SonataAdminBundle.[your_language].xliff to
app/Resources/SonataAdminBundle/translations/SonataAdminBundle.[your_language].xliff
Find the key link_action_create and change the the target text:
<trans-unit id="link_action_create">
<source>link_action_create</source>
<target>Add new</target> //Change to what ever you want.
</trans-unit>
If values do not change Clear cache, sometimes the old values from cache are shown:
php bin/console cache:clear

Related

Drupal 7: How do I extract specific field in a taxonomy page

How do I extract specific field for display in a taxonomy page?
I have a custom content type called "film" and each film has a Term Reference field called "casting". As expected I can click on a "casting" (tag) it brings me a page where all films are listed wherever this tag is associated. For expample if I click on "Kate Winslet" from movie Titanic, I land on a page http://localhost/mysite/tags/kate-winslet where other movies of Kate Winslet are listed. Up to this point everything is just fine.
I do not want Drupal to pull in and show default fields like just Title and Body in its own display format. Rather I want it so that I can display a photo from each film, year of release and of course the title and trimmed version of the body. I only want to customize the content of this page so that I have the control over What to Show and Where To Show a specific field value.
This is what I tried:
I cloned and put page.tpl.php in my theme's template folder. Renamed it as page--vocabulary--tags.tpl.php. Then I took out the following line of code (<?php print render($page['content']);?>) from my page--vocabulary--tags.tpl.php. The intention was to check whether the overridden template is actually being accessed by Drupal or not. It does!
But I am not been able to extract fields like field_photo or field_release_date from $page['content]. To get an idea about defined variables and how they are placed I used the following line of code:
<pre><?php /*print var_export(get_defined_vars(), TRUE);*/ ?></pre>. But even from there I could not extract a particular field like I mentioned above. The fields look to be somewhere inside $page['content']['system_main']['nodes'], but I don't know how to get to a specific field directly.
I also created a template.php with the following preprocess hook function:
<?php
function introduction_preprocess_page(&$vars) {
if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
$term = taxonomy_term_load(arg(2));
$vars['theme_hook_suggestions'][] = 'page__vocabulary__' . $term->vocabulary_machine_name;
$vars['content'] = $vars['page']['content']['system_main']['nodes'];
}
}
?>
Both <?php print render($content) ?> and <?php print render($page['content']) ?> print the same result but I want something like <?php render($content['photo_field'])?> which I am not been able to.
I am sorry for making this too long. I have just stepped into Drupal. So wanted to make sure that what I am trying to explain matches exactly what I want to accomplish.
You are probably trying the long way to this.
You can use Views module. It allows to create custom listings querying the database, but also override existent ones, like the case of the taxonomy term page listing.
Once you have the module installed (if it's not yet), particularly the Views UI module, go to /admin/structure/views and scroll to bottom, where disabled views (grayed rows) are. You'll find one called Taxonomy term, described as 'A view to emulate Drupal core's handling of taxonomy/term.'
Click Enable on the right of it and then go to the same place where the Enable link is, click the arrow to unfold and choose Edit.
Once you're in the view edit page, you can manipulate the listing at your convenience, adding/removing fields or whatever you want to do in your particular case. If you are not familiar with Views, I recommend you to learn about it, there is a lot of related content on the web and it is close to essential for Drupal development.
Also, if you want to add more customisation to the page, you can use the same approach with the Panels module, who allows to override system pages (not just listings like Views).

Drupal 7 Multistep forms - Remove save & preview button until last step

I have made a multistep/page form in Drupal (the field type is a multipage group, with multipages nested).
The form is 6 pages, and there is required info on every page. The problem is, Drupal puts a "Save" and "Preview" button on the bottom of every page of the form. Really, you CANNOT preview the form or save it until all required fields are filled out. So when users are going through the form and they hit "save" halfway through or "preview" halfway through, they get a ton of errors.
Is there any way to remove the "save" and "preview" buttons until they are on the last page (i.e. page 6 only)?
Thanks.
EDIT: I am using Field Groups to build my form by the way.
There isn't any module I found to do this, not in it's entirety anyway.
We ended up removing the preview button completely with CSS, and installing a module (Required For Publishing) that allows you to specify "Fields Required for Publish" vs fields required to save a draft. Now there's only 3 fields to save a draft for later, but 20+ fields required to publish the event/form.
We used javascript in the multipage.js form to validate on each step so they can't move on without filling out the actual required fields on each page.
You'd have to make your own module and use hook_form_alter .. https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_form_alter/7 .. and check which step you are currently on .. and then remove the buttons if you are not on the last step .. and enjoy.
Something like .. unset($form['actions']['preview']);

Iframe content not able to save in module params Joomla

I am using Joomla3 with tinymce editor. I have created one module and adding one params in textarea
I am adding iframe code
in text area
but it's not saving. If i am save normal text string then it's saving
Please help me
I believe you need to add a filter to your xml code.
such as:
filter="RAW" or, probably more appropriately, filter="HTML"
This will keep Joomla from cleaning your code. There are a number of filters available to XML fields when creating modules. You can examine the code here: https://github.com/joomla/joomla-cms/blob/master/libraries/joomla/filter/input.php#L167 to see the exact list.
What user group is the account you are using a member of? Super Users and Administrator group types should have no filtering set by default but it sounds like you might need to edit those settings.
From the main menu:
System > Global Configuration > Text Filters (tab)
You will see all the available user groups for you website. The group your user belongs to should have a Filter Type of No Filtering. Another important note is its better to add the user account to a group with the permissions then to arbitrarily adding it to a group type typically reserved for registrants, guests or low-level editing.

Drupal 7 - Print Module - Choose content to print

I am using the Print module in my Drupal 7 site (www.kooknet.be).
How can I choose which fields are printed in my custom content type?
I already added the "print-page" class to several HTML tags, but I can't get it to work.
Thanks.
If you have the Print module installed, you can set which fields are displayed for the 'print' view mode easily from the admin interface!
Go to the 'Manage Display' screen for your content type: /admin/structure/types/manage//display
Once you enable the Print module, you should start seeing a 'Print' display option in the collapsed list of display options available
Check that display option (and any others that are relevant to your content type) and hit 'Save'
Now you'll see that that display option is added and you can add or hide fields from it as you please!
:-)

How to change the label of view/results buttons in Webform drupal-7

I am a newbie in drupal, webform and php. Actually I have installed the drupal-7 with the webform module and I want to modify the text of options i.e. "view" to "create project" and "Results" to "View Projects"...
I searched for solution and I noticed that best option is to create a custom module and use hook_form_alter() to modify, so I have created a custom module. But I dont know how I can modify.
Kindly excuse me if the solution is already there (I could not find it :( )
"View" and "Results" are actually menu items, which you can modify by implementing hook_menu_alter().
http://drupal.org/node/483324
The following code in a custom module (change MODULENAME to the name of your module) will update the "Results" tab without a hitch, however the "View" tab is trickier because that's the core "view node" menu item. The code below will update this menu item for ALL node types, not just webforms. If you don't see the changes, clear your cache.
As far as I know there is no way to alter menu items ("View" in this case) for specific node types. See http://drupal.org/node/754508 for some attempts and discussion.
function MODULENAME_menu_alter(&$items) {
// change webform "Results" to "View Projects"
$items['node/%webform_menu/webform-results']['title'] = t('View Projects');
// change "View" to "Create Project" - affects *all* node types, not just webforms
$items['node/%node/view']['title'] = t('Create Project');
}
Ey I found one easy way to change everything in everything drupal 7 maybe in others try the moduls to install is String Overrides, link: http://drupal.org/project/stringoverrides, then you put the name in the configuration username and the newname
I hope this information is useful
add a picture how! >> http://s2.subirimagenes.com/otros/previo/thump_7143242string.jpg

Resources