Need an advice on understanding WP Hook? Accordion Tab Changes and moving position - hook-woocommerce

I need some advice or some guidelines. I have found a WP Hook - and I want to apply this WP Hook, but for some reason, I am missing code.
<?PHP
/**
*WooCommerce Template Hooks
*
* Action/filter hooks used for WooCommerce
functions/templates.[image describes the goal of the
using the hook and changing position and moving it to
the top](https://i.stack.imgur.com/8HtRl.png)
* #author James
* #category Additionary Summary _ Woocommerce -
Description Tab Accordion Change
* #package WooCommerce/Templates
* #version 2.1.0
*/
remove_action(
'woocommerce_product_additional_information',
'wc_display_product_attributes', 10 );
add_action(
'woocommerce_product_additional_information',
'wc_display_product_attributes', 12 );
But when I apply it - doesn't seem to make any changes. I want this to act as a plugin where I can upload or use snippets.

Related

How add react-relay component to the storybook?

I am trying create a storybook for my react-realy app, but i don't know how to set mockup data for that component. For simple a component it is ok, because i can use dummy UI component vs Container approach, but i can't use this for nested relay components, for example there is a UserList component, which i want add to storybook, i can split relay fragment part to container and UI part to the component, but what if UserList children are too relay component? I can't split their when they are a part of the composition of UserList?
Is there some solution for add relay components to the storybook?
I created a NPM package called use-relay-mock-environment, which is based on relay-test-utils which allows you to make Storybook stories out of your Relay components.
It allows nesting of Relay components, so you can actually make stories for full pages made out of Relay components. Here's an example:
// MyComponent.stories.(js | jsx | ts | tsx)
import React from 'react';
import { RelayEnvironmentProvider } from 'react-relay';
import createRelayMockEnvironmentHook from 'use-relay-mock-environment';
import MyComponent from './MyComponentQuery';
const useRelayMockEnvironment = createRelayMockEnvironmentHook({
// ...Add global options here (optional)
});
export default {
title: 'MyComponent',
component: MyComponent,
};
export const Default = () => {
const environment = useRelayMockEnvironment({
// ...Add story specific options here (optional)
});
return (
<RelayEnvironmentProvider environment={environment}>
<MyComponent />
</RelayEnvironmentProvider>
);
};
export const Loading = () => {
const environment = useRelayMockEnvironment({
forceLoading: true
});
return (
<RelayEnvironmentProvider environment={environment}>
<MyComponent />
</RelayEnvironmentProvider>
);
};
You can also add <RelayEnvironmentProvider /> as a decorator, but I recommend not doing that if you want to create multiple stories for different states/mock data. In the above example I show 2 stories, the Default one, and a Loading one.
Not only that, it requires minimal coding, where you don't need to add the #relay-test-operation directive to your query, and the mocked data is automatically generated for you using faker.js, allowing you to focus on what matters, which is building great UI.
Feel free to review the source code here if you want to implement something similar: https://github.com/richardguerre/use-relay-mock-environment.
Note: it's still in its early days, so some things might change, but would love some feedback!
I also created relay-butler, which is a CLI that takes in GraphQL fragments and outputs Relay components, including a auto-generated query component that wraps the fragment component, and Storybook stories (the Default and Loading ones by default) that wrap that query component. And literally within minutes, I can create beautiful Relay components that are "documented" within Storybook.
Would also love some feedback for it!

Webix: how to dynamically load components from external js file into a layout?

I would like to know how to update a row/col and or layout from an external js file on webix. Let's say I have a menu at the left of the screen (col[]) and want to update the right column based on a menu selection. If the menu is composed by
Customers
Orders
Products
And want to update the right column based on the selection calling customers.js, orders.js and products.js
Just like http://webix.com/demos/admin-app/#!/app/orders
That example is very advanced for me, I would like to learn some basic method.
Thanks
Oscar P
You can use webix.ui command or addView API to add a new UI to some specific place on the page.
webix.ajax("config.json", function(text){
$$("layout").addView( JSON.parse(text) );
})
or
webix.ajax("config.json", function(text){
webix.ui( JSON.parse(text), $$("cell_to_replace"));
})
Aquatic,
I also found out an example with .showBatch() API but the console shows "Uncaught TypeError: $$(...).addView is not a function" on both functions, are those part of PRO version? what is wrong?
My code is:
$$("workArea").addView("clientes");
or
$$("workArea").showBatch("batClientes");
on:{
onMenuItemClick:function(id) {
$$("workArea").addView(id);
}
}

Extending SAP Fiori App - Adding button in the footer

I am extending hcm.emp.payslip app and need to add a button in the footer....what is the right way of doing it?..
option 1: placing a extension point as described in page 13 of this pdf.. -- it didnt work..I followed exactly the steps mentioned. or will this not work as we are inserting an extension point ourselfs and which is not supported now.?
option 2: extending UI controller hooks as described here -- I couldnt try this as the documentation is very brief and I am a beginner...Also I am not sure if we can change the view by extending controller
I am using eclipse, and installed the Tool kit plug-in, some places I saw they recommended using Web IDE, but we would like to do it using tool kit, as I am not sure if we have cloud HANA access. or is it still fine to use the UI tool kit way..
would like to suggest the right approach with detailed steps...
Your Option 1 is not possible(Why? Because to add button to the footer there is controllerHook not UI extension point)
Go with Option 2 there are already extensionHooks given in all the controllers (S3.controller.js and in S3_phone.controller.js) of detail pages of the application.
controllerHook : extHookChangeFooterButtons
by Default SAP builds headerFooterOptions and sends that object to your extension Hook
/**
* #ControllerHook Modify the footer buttons
* This hook method can be used to add and change buttons for the detail view footer
* It is called when the decision options for the detail item are fetched successfully
* #callback hcm.emp.payslip.view.S3_Phone~extHookChangeFooterButtons
* #param {object} objHdrFtr-Header Footer Object
* #return {object} objHdrFtr-Header Footer Object
*/
if (this.extHookChangeFooterButtons) {
objHdrFtr = this.extHookChangeFooterButtons(objHdrFtr);
}
So you in the extended controller, receive the same append:
extHookChangeFooterButtons: function (objHdrFtr) {
//first if the buttonsList is empty, create one.
//Actually in S3.controller.js buttonsList is not defined since there are no buttons
if (!objHdrFtr.buttonList) {
objHdrFtr.buttonList = [];
}
//then create a button:
var extendedButton = {
sId: "EXT_BUTTON",
sI18nBtnTxt: "SAMPLE", //make sure you add texts in respective i18n files
bEnabled: true,
onBtnPressed: function (evt) {
that.handleExtButtonPress(evt);
}
};
objHdrFtr.buttonList.append(extendedButton)
//as you can see SAP says to return the object
return objHdrFtr;
}
Suggestion: Its very easy to do it in Web IDE.
Why?
It takes no time SETUP.
Very easy to use, saves lot of time
Shows all controllerHooks,
extension Points in UI
For the above example in Fiori Inbox use B.aButtonList.push(extendedButton); which will add the button to the end of the list (instead of append)

Disable inaccessible links in Dokuwiki?

Is there any way in Dokuwiki to make links to inaccessible articles (due to insufficient access rights) appear disabled?
I would prefer such a link to be gray and inactive, with perhaps a lock icon, rather than having the user getting an error message when the link is clicked.
This would basically require to disable the cache for each and every page and make your wiki much slower. So I guess the answer is no.
Hmm, something like
global $ID;
if ( auth_quickaclcheck ( $id ) < AUTH_READ ){
...here add .acldisable to $id;
...here add class "disabled" to $id;
}
in core link renderer
and in CSS add .acldisable { color: gray; }

JIRA layout per-project

Would it be possible to use a project-specific stylesheet for JIRA projects?
For example, if I would like to include project X in an iframe, I'd like to hide the logo and possibly the JIRA toolbar - for specific user groups for example (it's only for viewing purpose, it is not a security feature)
Granted that I'd have to implement this myself (through the webservice api for example) - are there templates for the standard issue page?
Thanks in advance!
There is a (currently undocumented) plugin point in JIRA for inserting top navigation components, <top-navigation>.
You can use this plugin point to add your own navigation bar, and perhaps hide the normal bar using an inline CSS stylesheet. The following example triggers this behavior by using a ?hideit=true query parameter, which is the simplest way to approach the "embed in iframe" problem. You could make that "sticky" by storing it in a session or cookie.
Once you have created a plugin that plugins into the <top-navigation>, hiding the top bar is simple. Here is a velocity script that does it:
#if ($hideHeaderHack)
<style>
\#header {display:none;}
</style>
HIDDEN (remove this message eventually)
#else
NORMAL (remove this message eventually)
#end
To create such a plugin, use the Atlassian Plugin SDK (use atlas-create-jira-plugin). Your atlassian-plugin.xml should look like:
<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
</plugin-info>
<top-navigation key="standard-navigation-top"
name="Tigerblood"
class="com.madbean.topnavhack.TopNav" state='enabled'>
<resource type="velocity" name="view" location="topnav.vm"/>
<order>5</order>
</top-navigation>
</atlassian-plugin>
Your top-navigation implementation class (called com.madbean.topnavhack.TopNav above) should look like:
public class TopNav implements PluggableTopNavigation {
private TopNavigationModuleDescriptor descriptor;
public void init(TopNavigationModuleDescriptor descriptor)
{
this.descriptor = descriptor;
}
public String getHtml(HttpServletRequest request) {
Map<String,Object> params = new HashMap<String, Object>();
params.put("hideHeaderHack", "true".equals(request.getParameter("hideit")));
return descriptor.getTopNavigationHtml(request, params);
}
}
Your plugin will be laid out something like:
./pom.xml
./src/main/java/com/madbean/topnavhack/TopNav.java
./src/main/resources/atlassian-plugin.xml
./src/main/resources/topnav.vm
Disclaimer I work for Atlassian as a developer in the JIRA team.
I don't believe this functionality is exposed directly, and you don't state what JIRA version you are using, but in 4.x in \atlassian-jira\includes\decorators there is a file called bodytop.jsp the has the following fragment that renders the top level navigation and toolbar elements:
// Render all the top nav plugins
for (Iterator iterator = topNavPlugins.iterator(); iterator.hasNext();) {
TopNavigationModuleDescriptor topNavModuleDescriptor = (TopNavigationModuleDescriptor) iterator.next();
PluggableTopNavigation pluggableTopNavigation = (PluggableTopNavigation) topNavModuleDescriptor.getModule();
%>
<%= pluggableTopNavigation.getHtml(request) %>
<%
}
%>
If you wanted to you could create a version of the dashboard rendering jsp that calls a modified bodytop.jsp that renders none of the usual nav elements.
I would be tempted to write a basic plugin to do this.
Take a look at http://confluence.atlassian.com/display/JIRA/Web+Resource+Plugin+Module
If you have yet to write a jira plugin, now might be the time to try it out http://confluence.atlassian.com/display/DEVNET/Developing+your+Plugin+using+the+Atlassian+Plugin+SDK .
I'm currently running Jira 4.2.2 and wrote a plugin that implements PluggableTopNavigation for a custom navigation bar. Unfortunately, this functionality, as detailed in the awarded question, is now depreciated.
My plugin added a div to the top of the Jira header that created a nice menu for use with our development pages. The source of the menu was hard-coded into the plugin and located as a static menu.html file on our server for sharing across different pages.
Since I'd have to completely redesign the plugin for Jira 5.2, I started searching for different ways to re-implement the menu. Here's what I settled on. It's not pretty, but it makes it so you don't have to write a plugin.
Change your announcement banner (quickly get there by typing 'gg', then search for announcement banner) to the following:
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery.get("http://path.to.server/menu.html", function(data){
jQuery("#header").prepend('<nav class="global" role="navigation">'+data+'</nav>');
jQuery("#top-level-id-of-navbar a").css("color", "white")
});
});
</script>
Replace the menu.html link with your own link. The color of the header was inherited by the links in my menu, so I had to change them back to white after inserting the html page.
The result looks identical to Jira 4.2.2, so I'm happy.

Resources