"Theme Customizer" - different background image for different category - background-image

I'm trying to make setting in theme customizer which will allow me to choose different background image to different category. I have two settings working separately, but i don't know how to combine them to work together and it seems like there was no problem like this before.
In theme customizer it looks like
> this <.
How make it work together?
EDIT:
I was trying in many ways to acomplish this, but only thing that worked as i wanted was creating a section for each category and add background image there, like this:
$wp_customize->add_section( 'background_section_cat_a', array(
'title' => __( 'Category: cat_a', 'twentythirteen-child'),
'description' => 'Options prepared to change background settings', 'twentythirteen-child',
'priority' => 160,
'panel' => 'background_panel',
));
$wp_customize->add_setting( 'background_image_cat_a', array(
'default' => 'abc.jpg',
));
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'background_image_cat_a', array(
'label' => __( 'Select background image', 'twentythirteen-child' ),
'section' => 'background_section_cat_a',
'settings' => 'background_image_cat_a',
)));
and use this setting:
body.category-cat-a {
background-image: url(<?php echo get_theme_mod('background_image_cat_a'); ?>);}
But when I add new category, I have to enter my theme customizer options and add it there, and it is very time time consuming.

There is another way:
1. Add custom field with image to your Category taxonomy
2. call your image in category.php page.

Related

Is it possible to remove the 'Delete' and 'Add x' on the 'table' field for Laravel Backpack?

I'm currently setting up a backpack CRUD for languages/translations, and I'd like the translations to be bulk editable from the language CRUD. I've currently got that working through the update operation like so:
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
CRUD::addField([
'name' => 'translations',
'label' => 'Translations',
'type' => 'table',
'entity_singular' => 'translation',
'columns' => [
'key' => 'Key',
'text' => 'Text'
]
]);
}
Which looks like this:
preview image
The problem I'm running into here is that all the 'keys' should be static (but still displayed), as well as that users shouldn't be able to 'add' translations or remove them. (Translation creation is handled by setting up default translations each time a language is created)
Is it possible to
Make it so that the 'key' column is uneditable but still displayed.
Remove the 'Add translation' button at the bottom of the table.
Remove the 'Delete' trashcan icon at the end of each translation line
Many thanks in advance!
Add these lines to your Controller. You can add it anywhere but I prefer to add in public function setup()
$this->crud->denyAccess('delete');
$this->crud->denyAccess('create');
However user cannot add Translation but this will not remove the + Add Translation button. So to remove that button also,
remove this line
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
Sources:
https://github.com/Laravel-Backpack/CRUD/issues/257
https://backpackforlaravel.com/docs/4.1/crud-operation-show

How to add custom action button in suiteCRM module sub panel list?

I need some suggestion in my suite CRM module integration.
I have a sub-panel in one of my modules and required to add one more edit button to redirect to a custom form to take some input from the user for each row separately.
Below is a sample image of my sub-panel list view.
In the above image on click of the edit button of a row, there is a remove button, I want to add one more custom button after remove and need to redirect from there to my new form.
I have checked some of forums and blogs but didn't found the solution.
To add a button you will need to modify the metadata of that sub-panel. In metadata, you will see the following code for the Edit and Remove buttons:
'edit_button' =>
array (
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'module' => 'Contacts',
'width' => '5%',
'default' => true,
),
'remove_button' =>
array (
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
'module' => 'Contacts',
'width' => '5%',
'default' => true,
),
You can add your new button using same array syntax. As you can see that every button use specific widget class(defined as widget_class) therefore you will need to add new widget_class class for that. You can find existing widget classes in this folder: include/generic/SugarWidgets.
Cheers!

SuiteCRM setting initial_filter of the aos_products popup

I need to add a custom filter to the aos_products popup where you can choose the line items from the aos_quotes edit view.
What the filter should look like is equal to WHERE aos_procucts_cstm.remaining_capacity_c > 0.
What I have so far is in editviewdefs.php of the aos_product module:
array(
'name' => 'remaining_capacity_c',
'label' => 'LBL_RESTKAPAZITAET',
'displayParams' =>
array(
'initial_filter' => array(
'&remaining_capacity_c > 0',
),
),
),
but this does not work as intended. I believe that it is not possible to set up the filter like I did. So any suggestions are highly appreciated.
Following below steps:
remaining_capacity_c needs to be a field type that where you can "Enable Range Search" in studio. So I would suggest using "Integer" type in this case.
Second, you will need to add the field into the popup search definition.
you will need to set the variables required to do a range search.
Example:
'initial_filter' => array(
'&remaining_capacity_c_advanced_range_choice=greater_than&range_remaining_capacity_c_advanced=0&start_range_remaining_capacity_c_advanced=&end_remaining_range_capacity_c_advanced=',
),
EDIT
You can use the keys found in date_range_search_dom dropdown. just set the [fieldname]_advanced_range_choice to one of the keys and range_[fieldname]_advanced to the value you wish to compare. When you wish to edit the start and end. You need to specify the start_range_[fieldname]_advanced and end_range_[fieldname]_advanced values.

How to change the default order of the sub panels in the opportunities module

I have a need to change the default order of the sub panels in the opportunities module. I have been looking for a solution for a while and have not found a solution that works.
I am using SugarCRM CE 6.5.13
Thanks in advance.
Your question is actually unclear. Are you asking for the order of a subpanel meaning how to place one subpanel above another. Or is your question concerning the order of the data inside a subpanel?
A fast response to both is:
in {MainModule}/metadata/subpaneldefs.php there should be the sort order declared for the subpanel like this:
$layout_defs[{MainModule}] = array(
// list of what Subpanels to show in the DetailView
'subpanel_setup' => array(
'{TheSubpanel}' => array(
'order' => 1, // influences the place of the subpanel relative to the other subpanels
'module' => '{TheSubpanel}',
'subpanel_name' => 'default', // attention please check the subpanel module to make sure there is not another setting overriding this setting
'sort_order' => 'desc',
'sort_by' => 'date_entered',
...
check also the file defined above that contains the subpanels fields. In this case it can be found in {TheSubpanel}/metadata/subpanels/default.php
$module_name = '{TheSubpanel}';
$subpanel_layout = array(
'top_buttons' => array(
'where' => '',
'sort_order' => 'desc',
'sort_by' => 'date_entered',
Please consider that after a change you need to run 'rebuild & repair' and if you manually clicked on a sort field then you should clear your cookie cache and log in again too.
There are other questions on stack overflow concering this like how-to-change-default-sort-in-custom-subpanel-sugarcrm
If you do not want code level customization then you can just drag and drop the sequence of subpanels on detail view of record. The sequence of subpanel will be saved.

Magento Custom Module - WYSIWYG image browse issue

I have a custom module with a content field (WYSIWYG editor)
When I select the insert image button, the following popup appears. For some reason the 'browse' button at the side of the Image URL has disappeared. Can someone point me in the right direction to get the image icon back? (what block/controller etc)
What is required when adding the full featured WYSIWYG editor to a custom magento module?
This is my form field element within Form.php (block)
$fieldset->addField('post_content', 'editor', array(
'name' => 'post_content',
'label' => Mage::helper('faqs')->__('Answer'),
'title' => Mage::helper('faqs')->__('Answer'),
'style' => 'width:700px; height:500px;',
'wysiwyg' => true,
));
Thank you.
Jonny
Had to find out the hard way, but the solution is quite simple:
Please check the permissions of your Role your Admin is in unser System=>Permissions=>Roles
There you can find in the Tab "Role Resources" the Checkbox "Media Gallery". Make sure this checkbox is ticked!
Then, clean cache, log out and in again and it should work.
Cheers!
I managed to sort this by adding some configuration options to the field,
Add the following code above the addField() of your WYSIWYG,
$configSettings = Mage::getSingleton('cms/wysiwyg_config')->getConfig(
array( 'add_widgets' => false, 'add_variables' => false, 'add_images' => false, 'files_browser_window_url'=> $this->getBaseUrl().'admin/cms_wysiwyg_images/index/'));
Once you've added the code, you need to add another param to the addField called 'config' calling your $configSettings variable.
$fieldset->addField('post_content', 'editor', array(
'name' => 'post_content',
'label' => Mage::helper('faqs')->__('Answer'),
'title' => Mage::helper('faqs')->__('Answer'),
'style' => 'width:700px; height:500px;',
'wysiwyg' => true,
'config' => $configSettings
));