How to enable backend layout selection for users - typo3-9.x

I create a site based on Typo3 9.5.12 / Bootstrap Package 11.0.2.
I need to enable my editors to select a backend layout for new pages (!).
So far I did not find a way to do so. Setting Page TSConfig for the editors group like so gives me the following result:
page.TCEFORM {
pages {
abstract.disabled = 1
backend_layout.disabled = 0
backend_layout_next_level.disabled = 0
}
}
Abstract field is disabled as expected.
Backend Layout cannot be selected. What can I do?

Have you granted access to these fields in the BE-Group definition?

Related

typo3 9.5 - how to get rid of gray header box?

When I use my h1 and h2 styles in a text content element in typo3 9.5, they get nicely displayed as I want.
However when I use the header field of the element, I get this grey box and not my h1 format.
How can I configure typo3 to show h1 style there?
If you use fluid styled content (FSC) or packages which are using FSC (like bootstrap package) you will find the templates of your content elements (CE) in these extensions, from where you can copy it to your site extension and after adding your path to the paths list your modified template is used to render that CE.
This is the typoscript configuration to modify the rendering of the extension bootstrap_package:
lib {
contentElement {
layoutRootPaths {
// 0 = EXT:bootstrap_package/Resources/Private/Layouts/ContentElements/
10 = EXT:my_site_extension/Resources/Private/Layouts/ContentElements/
}
partialRootPaths {
// 0 = EXT:bootstrap_package/Resources/Private/Partials/ContentElements/
10 = EXT:my_site_extension/Resources/Private/Partials/ContentElements/
}
templateRootPaths {
// 0 = EXT:bootstrap_package/Resources/Private/Templates/ContentElements/
10 = EXT:my_site_extension/Resources/Private/Templates/ContentElements/
}
}
}
The entries with 0 = are set by the ext:bootstrap_package (or similar by ext:fluid_styled_content) and show you the path to the templates which are used without your override.
The entries with 10 = (you could use any higher number to give preference to your templates) should show to the folders in your site extension (ext:my_site_extension), where you hold your modified copies.
You only need to copy templates you modify as the original paths are fallback to any template file which is referenced as template, layout or partial. Keep an eye on the paths as those files can be referenced with a (relative) path.
EDIT:
For FSC the rendering for a specific CE is done with a template of the same name in the template folder configured in typoscript (see above)
These files normally contain a call to the same layout file (Layouts/Default.html) which renders the header with the partial Header/All and different other html for spacing and anchors.
In the partial Header/All we have further partials which render the fields header, subheader and date if given with appropriate partials.
Note the additional arguments to these partials: layout, positionClass, link, default which will influence the appearance of the header.
Maybe your unusual appearance is given because there is a special header_layout in your records.
Or another extension already has overwritten the default templates (partials) to get those boxed headers instead of the h1-h6 HTML tags which are used in the FSC extension.

Vue Storefront: Display labels for custom attribute filter instead of option id

I am trying to figure out from couple of days how to display label for filters on category page. As mentioned in document I have added attribute inside config.products.defaultFilters[] and the filter have started showing there.
I have color and brand filters. For color filters I have mapped color id to color name in config.products.colorMappings so it is displaying correctly there. But for brand I can do the same but it is a static solution so every time admin adds new brand I will need to add its mapping and build the storefront again.
I have tried to check their forum but nothing useful. I checked Vue Storefront vuex catalog and category-next stores for hint but cannot find anything related there.
The label for option under brand_filter should be readable but it is showing that brand attribute option's id
Ok, after spending couple of days finding solution to this problem, I finally got a hint from this answer.
I am using theme vsf-capybara, and according to its guide, to setup I generated a local.json from generate-local-config.js and I merged configuration manually from that local.json to config/local.json file. Prior to this there was no filter named brand or color added already to the main config file.
The config property responsible for the filter labels to be incorrect was entities.attribute.loadByAttributeMetadata and it was set to true I changed it to false because core/module/catalog/CatalogModule has one action attribute/list needs to be dispatched for application use. So if entities.attribute.loadByAttributeMetadata in config/local.json is set to true, this action will not be dispatched. Here is the excerpt from CatalogModule:
if (!config.entities.attribute.loadByAttributeMetadata) {
await store.dispatch('attribute/list', { // loading attributes for application use
filterValues: uniq([...config.products.defaultFilters, ...config.entities.productListWithChildren.includeFields])
})
}

Removing stylesheets issues (wp_dequeue_style)

I'm having trouble removing (wp_dequeue_style) all the stylesheets loaded in a WP site.
I want to remove all the styles loaded, with the purpose of recreating a new style that can be better controlled and optimized and reduce 68 requests to 1.
But before I get further into this, I'll say a bit about the tools used.
I'm using Wordpress v5.4.1 on a server with Apache 7.2.30. The WP theme is MasterStudy Child and the plugins used are as follows:
Breadcrumb NavXT
BuddyPress
Contact Form 7
GamiPress
GTmetrix for WordPress
WPBakery Page Builder
MasterStudy LMS Learning Management System PRO
MasterStudy LMS
Paid Memberships Pro
Slider Revolution
GDPR Compliance & Cookie Consent
STM Configurations
Transients Manager
UpdraftPlus - Backup/Restore
WooCommerce
WordPress Importer
WP Reset
Query Monitor
I can get a list of all enqueued CSS stylesheets using 3 methods:
1. Chrome Inspector - Network tab
2. Query Monitor
3. The script bellow, used in functions.php of parent theme
function remove_theme_head_styles() {
global $wp_styles;
echo "<h2>Enqueued CSS Stylesheets</h2>";
foreach( $wp_styles->queue as $handle ) :
echo $handle . ", ";
endforeach;
}
add_action( 'wp_enqueue_scripts', 'remove_theme_head_styles', 9000 );
The results are as follows:
Method 1 (Chrome): 68 requests, though some are duplicates
Method 2 (Query Monitor): 66 Styles
Method 3 (php script): 52 results
Next, lets switch from listing all the enqueued CSS files, to removing them with this script
function remove_theme_head_styles() {
global $wp_styles;
foreach( $wp_styles->queue as $handle ) :
wp_dequeue_style( $handle );
wp_deregister_style( $handle );
endforeach;
}
add_action( 'wp_enqueue_scripts', 'remove_theme_head_styles', 9000 );
Let's see what we have now:
Method 2 (Query Monitor): 13 styles - all of them loaded in the footer. 10 of them are coming from the parent theme and the other 3 from the theme's main plugin MasterStudy LMS
Method 1 (chrome): 14 requests, same as QM except for 1 extra font family CSS
Method 3 (php script echo): 0 results
So, maybe we need to change the hook, go further down the hooks order, to also include the stylesheets enqueued in the footer.
Let's try wp_print_footer_scripts with a big number for priority
add_action( 'wp_print_footer_scripts', 'remove_theme_head_styles', 9000 );
The results are:
Method 1 (chrome): 65 requests, WTF? almost all of them have loaded!
Method 2 (Query Monitor): 0 Styles
Method 3 (php script): 0 results - same hook used for listing, wp_print_footer_scripts
And YES the webpage has rendered accordingly, so the Chrome Inspector is not wrong, but this doesn't mean that the other 2 methods have false results. It just means that the CSS files are re-enqueued after the results of methods 2 and 3 are generated
But how is this happening I cannot understand.
I have also tried splitting the removal process into 2 hooks, 1 with wp_enqueue_scripts and another with different hooks like wp_footer and such, but with no success
The 10 'trouble' styles coming from the theme itself, are loaded with this function
themes/masterstudy/inc/custom.php
function stm_module_styles($handle, $style = 'style_1', $deps = array(), $inline_styles = '')
{
$path = get_template_directory_uri() . '/assets/css/vc_modules/' . $handle . '/' . $style . '.css';
$handle = 'stm-' . $handle . '-' . $style;
wp_enqueue_style($handle, $path, $deps, STM_THEME_VERSION, 'all');
if (!empty($inline_styles)) wp_add_inline_style($handle, $inline_styles);
}
Here's an example of using the function above
themes/masterstudy/vc_templates/stm_mailchimp.php
stm_module_styles('mailchimp', 'style_1', array(), $inline_styles);
Obviously, if I comment that line then the CSS won't be loaded, but this is not the approach I want to take to solving the problem.
So, if anyone can offer some help, it would be much appreciated
Thanks for taking the time and reading through this
The below is likely not a great approach, but I recently needed to prevent VC from loading the free version of FontAwesome (I use the pro version in my theme) and no amount of dequeue/deregister would work - the below is the only way I could stop it loading (without editing files outside my theme).
The thing that actually worked, was brutally unsetting the entry in wp_styles.
function hack_dequeue_fa() {
global $wp_styles;
$remove = array(
'vc_font_awesome_5',
'vc_font_awesome_5_shims',
);
foreach($remove as $handle) {
wp_dequeue_style($handle);
wp_deregister_script($handle);
unset($wp_styles->registered[$handle]);
}
}
add_filter( 'wp_enqueue_scripts', 'hack_dequeue_fa', PHP_INT_MAX );

Drupal 7 - Print PDF and Panelizer

Hi guys ,
I'm currently working on a Drupal project which use the Panelizer module by overriding the default node display. The panel for this content type is made width a lot of rules and specifications in order to display some specific content (like views) according some fields.
Now I need to print in PDF the same content that is displayed by the panelizer module but in another display (in one column ), so I cloned the display I use and rearranged it to display what I want.Then I want to use this display width the print module but I didn't managed to do that.
Any idea how can I do that ?
I just can't use the default node render, because I would miss some informations dues to the specifications used in the panel, and I can't print the panelized content because it's not the same display.
I read this thread but how can I say to the print module to use the "print" display I cloned instead of the default one ?
Any suggestions or ideas will be appreciated or if you have another idea for doing that you're welcome :)
Thank you !
In your print pdf template you can load the node then create a view with the display and finally render it : drupal_render(node_view(node_load($node->nid), "name of your display")) ;
Another way is to alter node entity info, telling that 'print' view can be panelized, i.e.
/**
* Implements hook_entity_info_alter().
*/
function mymodule_entity_info_alter(&$entity_info) {
$entity_info['node']['view modes']['print']['custom settings'] = TRUE;
...
}
After that, you go to panelizer settings of your content type(s), and set whatever you want for the print view mode

How to add working query box to portfolioitemstreegrid app

We wanted to use the portfolioitemstreegrid(https://github.com/RallySoftware/app-catalog/tree/master/src/apps/portfolioitemstreegrid) app since there was an issue with the old PortfolioDrilldownApp. we were able to add the edit app setting options by adding:
getSettingsFields: function () {
var fields = this.callParent(arguments);
fields.push({
type: 'query'
});
return fields;
},
but that doesn't filter anything it just shows the box.
What do we need to add to get the query box to work. The app has a filter already but it isn't flexible enough for us to run the queries we need.
I hoped too that doing something like this will allow wiring up of query into the treegrid filter, but it does not work. There is no storeConfig on a treegrid:
if (this.getSetting('query')) {
config.storeConfig.filters = [Rally.data.QueryFilter.fromQueryString(this.getSetting('query'))];
}
In a month or so a new hierarchical tree grid app will become available, and it will take a query from the app settings dialog. I would not suggest extending this portfolioitemstreegrid, also because it is using the head (unstable) version 'x' of AppSDK2.