Override compodoc template - handlebars.js

Hello I am using compodoc 1.1.5 to generate the documentation for my angular project. Compodoc provides the ability to override the template by using the option --template folder_name. I tried to override the menu partial by creating a partial folder and putting a menu.hbs in it with the code from the original menu.hbs (the menu disappeared completely) even if I do not modify the original code. I am getting this error
Uncaught SyntaxError: Invalid or unexpected token menu-wc.js:34
Does any one have any idea about the proper way to override templates

Either create your own theme or create an additional doc folder.
The additional docs folder will accept .md and .html files.
See https://compodoc.app/guides/usage.html for more.

Related

Rebuilding wordpress core image block

I am trying to rebuild core/image block to add extra link in the caption, which would be a link to the extended description of object in the image on another page.
This requires both modifying block edit interface, as well as saved markup. So I opted to take core/image block from github (and necessary dependency in embed folder).
After little modifying of block (removing unneded exports in index.js of the block and adding registerBlock - because block registering for Gutenberg is done for all core blocks in single js file), block compiles fine. However, in the Wordpress Gutenberg editor, block throws an error. Error is:
Uncaught TypeError: Object(...) is not a function
I tracked down error to useBlockProps hook, which is undefined in javascript, although it is imported before (import { BlockAlignmentToolbar, BlockControls, BlockIcon, MediaPlaceholder, useBlockProps } from '#wordpress/block-editor';) I am using #wordpress/create-block scaffold and mentioned imports resolve through webpack.
Why am I getting an error an how to fix it?
I discovered that I used master branch of Github, where I took core/image block source. Obviously, useBlockProps is yet not part of the core (or not implemented in #wordpress/create-blocks webpack setup).
After switching to wordpress 5.5 Gutenberg branch version of image block, everything was fine.

How to set template path in redux framework?

I need to customize panel templates in my theme, which I use redux. I copied ReduxCore->templates->panel folder into mythemefolder->redux-framework->ReduxCore->templates->panel.
For some plugins, this overrides the templates from plugin, but not the case here, I found that I need to manually tell redux to look for the templates elsewhere other than default folder inside plugin. but I'm not sure how to do it.
I tried adding 'templates_path' => dirname(__FILE__).'/templates/panel', inside redux config file, but it just throws an error with Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW)
then I found in redux docx,(https://docs.reduxframework.com/core/advanced/filter-hooks/) that there's another way to put redux/{opt_name}/panel/templates_path, but it has no reference how, or where to put this code.
can anyone help me out please?
https://docs.redux.io/guides/advanced/panel-templates.html
Redux::setArgs('opt_name', array('templates_path'=> dirname(__FILE__).'/templates/panel/'));
That SHOULD do it.

Drupal 8 add javascript and pass data in a hook with custom module

I am building a custom module with Drupal 8. One of the requirements of the module is that it sets up a javascript file based on the configuration settings, which the user of the module sets up in module configuration.
The javascript which needs to be added to the page depends on the configuration settings. Hence I can not add it using Libraries as mentioned in this article: Adding assets to Drupal module.
I first implemented it using a block. I use Twig templates to pass the configuration variables in PHP to the twig file, and in the twig file, I have a tag to add the javascript based on the config variables. Refer Using twig templates.
The problem with this approach is that user needs to add the block on the page, and there is no UI facing element on that block. I also find it very messy.
Is there a cleaner way to add my javascript using hook and pass variables to it? I looked around and found hook_install and hook_page_attachments. So I can add Javascript, but don't know how I can pass any php variables to it.
I am new to Drupal development. Any help with this is really appreciated.
TL;DR I need to find a way to add Javascript using Drupal hook and pass some PHP variables to it.
Use in hook_page_attachments:
$attachments['#attached']['drupalSettings']['myvar'] = $myVariable;
Then in your js (I assume you already know how to attach js library):
(function ($, Drupal, drupalSettings) {
Drupal.behaviors.my_custom_behavior = {
attach: function (context, settings) {
var strings = drupalSettings.myvar;
...
}
}
})(jQuery, Drupal, drupalSettings);
See nice Acquia tutorial for more examples.

Semantic UI: overriding a variable in site.variables

I would like to know how to override a variable in site.variables file. I am using Semantic UI with Meteor using the official meteor package.
Specifically, I want to override
#fontPath : '/lib/semantic-ui/src/themes/default/assets/fonts';
I tried to change the value directly in site.variables to no avail. Also, I added a value to site.override with no success.
Both files state at the top:
/*
DO NOT MODIFY - This file has been generated and will be regenerated
Semantic UI v2.0.8
*/
Where can I override this value? This is needed to fix this issue.
As stated here, the content of themes/ directory is not editable - it will get rewritten back when you run your Meteor server.
You need to edit site.variables.import.less file in your site/globals/ directory instead.

Using directives in new files

Is it possible to have additional "using" directives automatically added to my new aspx.cs files so that I do not have to keep typing the same ones over and over again (i.e. custom namespace using directives)
You can edit the files that are used by the template. Better yet, create your own. File + Export Template.
You don't have to type them in. When writing the code, type in the name of the class (without the namespace). Then hit CTRL+.. That will open up the resolve type intellisense helper. It will add the using statement to the top of the file. No scrolling necessary.

Resources