I like Context if Path /gallery Load A New Theme example "Bartik" Other page load "Omega" Theme
I Install the "Context Condition Theme" Modules But it does not working
What's your recommendation?
Use can use ThemeKey module.
Enable ThemeKey module and its required sub modules, then go to the config page at admin/config/user-interface/themekey. Here you will see may options for switching the theme.
As you required there is an option path:node_alias so select this option and also set the value as you want like you say /gallery and then select the theme you want to enable at this url.
For wildcard path use this setting as you required web/*:
Property: drupal:path
Operator: =
Value: %wildcard
Property: drupal:path:wildcard
Wildcard: wildcard
Operator: ~
Value: /^web/.*
Like this image reference:
Related
Since the last Visual Studio Code update, I've got problems with IntelliSense autocompletion. Generally if I want to set a function as a prop (it's the most common use case of this problem) then instead of inserting just function name VS Code is adding ={} brackets. So how to get rid of this:
const func = () => {}
...
<button
onClick={func={}}
/>
and get something like this:
const func = () => {}
...
<button
onClick={func}
/>
To clarify - no new add-ons were installed. It's happening for js/ts files when writing in React.
How to fix this
Open VS code.
Go to File > Preference > Settings then
type: run code in the settings search bar
Select Edit in settings.json to open the settings.json file
Add the "javascript.preferences.jsxAttributeCompletionStyle": "none" line to your settings.json file
Why we do this:
In the defaultSettings.json file there is this code snippet:
// Preferred style for JSX attribute completions.
// - auto: Insert `={}` or `=""` after attribute names based on the prop type.
// - braces: Insert `={}` after attribute names.
// - none: Only insert attribute names.
"javascript.preferences.jsxAttributeCompletionStyle": "auto",
therefore, the default setting for jsxAttributeCompletionStyle is auto and by setting it to "none" in your settings.json file you overwrite that default setting.
As a workaround, we can set JSX Attribute Completion Style to none.
https://github.com/microsoft/vscode/issues/171609#issuecomment-1387107873
I use asciidoctor in reactjs app and I want use highlight.js for source code selection, but attributes doesn't work.
By default, asciidoctor produces just the HTML for the Asciidoc source passed to it, not an entire page. If you want the headers and footers for the page, including the code require to fetch and run highlight.js, you need to add standalone: true to your processing options:
const converted = asciidoc.convert(file, {
standalone: true,
attributes: {
'source-highlighter': 'highlight.js',
'highlightjs-theme': 'dark',
}
})
See: https://docs.asciidoctor.org/asciidoctor.js/latest/setup/quick-tour/
and: https://docs.asciidoctor.org/asciidoctor.js/latest/processor/convert-options/
Alternatively, you can add the code import highlight.js and ask it to highlight the HTML produced by asciidoctor.
this is my problem...
I have some of images and links that I want to load different joomla modules when user click on them.
mean each hyperlink can load another module|position
thanks all
In case that you just want to call a module's content from a url the following answer will help you.
If you just want to show / hide a module in the same page you could use something similar to my previous answer: Joomla 3 Show different modules on same position depending on toggler
Joomla provides the functionality to call a specific file of the active template by adding the tmpl=FILENAME key/value to the url's query string.
All built-in templates have a component.php file if user wants to load the template with the component only. You could check the following link for more details: Adding print pop-up functionality to a component.
You could do something similar to only show the modules that you want to load.
You could copy the component.php to a new file (I have used custom.php) and added the following php code in the <body> ... </body> part.
<?php
$jinput = JFactory::getApplication()->input;
$selectedPosition = $jinput->getString("position", "");
$selectedModule = $jinput->getString("module", "");
$selectedModuleTitle = $jinput->getString("title");
if($selectedPosition !== "") {
$modules = JModuleHelper::getModules($selectedPosition);
foreach ($modules as $module) {
echo JModuleHelper::renderModule($module);
}
} elseif ($selectedModule !== "") {
$module = JModuleHelper::getModule($selectedModule, $selectedModuleTitle);
echo JModuleHelper::renderModule($module);
}
?>
So with a similar way as loadposition / loadmodule works you could call the new template file using:
index.php?tmpl=custom&position=MODULE_POSITION
or
index.php?tmpl=custom&module=MODULE_TYPE
or
index.php?tmpl=custom&module=MODULE_TYPE&title=MODULE_TITLE
Optionally if you want to load the module with a specific style, you could pass it to the second paramter of the renderModule method like:
echo JModuleHelper::renderModule($module, array("style" => "xhtml"));
Hope this helps
I am trying to set theme dynamically in cakephp 3.x . So I have to check theme exist or not. If exist than I will set otherwise it will get default theme.
if($themeNameExist){
$this->viewBuilder()->theme($themeName);
}
But i did not get any function or way how can I check theme exist or not? Anybody can you help?
In CakePHP 3, themes are plugins, so you could use the functionality for testing whether a plugin is loaded, like
use Cake\Core\Plugin;
if (Plugin::loaded($themeName) === true) {
}
See also API > \Cake\Core\Plugin::loaded()
Depending on why exactly you need to check/set themes dynamically, it might be wise to maintain a whitelist of allowed theme names, as allowing to arbitrary reference plugins (which don't necessarily have to be themes), may to some extent pose a security problem!
$allowedThemes = [
'FooTheme', 'BarTheme', 'BazTheme'
];
if (
in_array($themeName, $allowedThemes) &&
Plugin::loaded($themeName) === true
) {
}
I have find one solution such as where I have checked theme folder exist or not.
use Cake\Filesystem\Folder;
$themeName = 'ThemeName';
$Folder = new Folder(ROOT);
if ($Folder->inPath('plugins' . DS.$themeName)) {
$this->viewBuilder()->theme($themeName);
}
I have been searching for a few days to figure out how to change the options for the swiper (v 7.x-1.4) module in Drupal-7. The documentation is clear-as-mud explaining how the module expects this hook to be used. I'm looking for a simple code example on how to implement the following options from the swiper API:
autoplay
prevButton
nextButton
autoplayDisableOnInteraction
The only documentation reference I have been able to find is from the README.txt in the module:
...
You can also add, change and remove, any of API options of the Swipers,
just you need to implement a hook:
hook_swiper_options_alter($node, $plugin_options) {}
This way the module will handle pass these options to the script that
instantiates the swiper Plugin.
...
I'm fairly new to Drupal, but I am trying to learn. I have attempted to create a simple custom module to implement these options. I have called my module myCustom, created the /drupal/sites/all/modules/myCustom directory with the following files:
myCustom.info:
name = myCustom
description = customize swiper
package = me
version = 0.02
core = 7.x
files[] = myCustom.module
myCustom.module:
<?php
function myCustom_swiper_options_alter($node, $plugin_options)
{
$plugin_options += (
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
paginationClickable: true,
autoplay: 2500,
autoplayDisableOnInteraction: true
);
return($node, $plugin_options);
}
I know I have multiple problems. Drupal refuses to enable my module as-is and I can not figure out why. I have checked the admin->reports->recent log messages report and found nothing relevant to at least help me troubleshoot.
Any ideas how I can fix this? Does anyone have a working example of code that I can copy and modify to get this hook working?
Thank you in advance for any assistance!
You may want to read through this documentation: Writing module .info files (Drupal 7.x).
Remove this line from your .info file: files[] = myCustom.module. Drupal will automatically read through the .module file.
As you defined a version in your .info file this may need your attention: Release naming conventions, but actually you can just leave that out as well, it's not mandatory.
Since you're using a hook from that swiper module, I recommend to set it as a dependency in your custom module's .info file as: dependencies[] = swiper to prevent unmet dependency errors.
Change the $plugin_options array to a php array & do not return anything:
<?php
function YOUR_MODULE_swiper_options_alter($node, &$plugin_options) {
$plugin_options += array(
'nextButton' => '.swiper-button-next',
'prevButton' => '.swiper-button-prev',
'paginationClickable' => true,
'autoplay' => 2500,
'autoplayDisableOnInteraction' => true,
);
}
Additionally: Try to refrain from using capitals in module names as per machine name (module dir name). If you take a look at other Drupal modules in /modules or sites/all/modules they're all lowercased. (You can leave the name in your .info file which also represents your module in the modules list as you have now.)