theming – Passes the variable from the custom module to the topic template

How can I pass a variable from my custom module to a topic field template?

my field template is the "Field – Node – Field Web Form – show-visit.html.twig"

and my module is called "customodule"

I've tried this feature according to the documentation, but apparently I did not understand smth correctly:

        Function logintosubmit_preprocess_field_node_field_webform_parliament_visit (Array & $ variables) {
$ VARIABLE_NAME = & # 39; my_variable & # 39 ;;
$ variable['varname'] = $ VARIABLE_NAME;
}

custom spelling – ActionMenu with empty entries until mouseover

Note: The following code requires version 12.0.

Problem Summary: I have a strange behavior with an ActionMenu, where the items in the menu are not displayed until the mouse pointer is moved over them (see below). I would appreciate it if you know how to fix this.

Enter the image description here

background: This is part of a package I am developing to provide sophisticated label / symbol notation for input and output cells. My specific application is chemistry, but the approach should be more general. The main idea is to have a list of string notations and link them to internal symbols. These string notations are tagged in a TemplateBox, which is useful for the style. I want the user to be able to quickly define these notations, as this is a common tool I use in the classroom. Using this approach to output cells is simple, but a bit more difficult for input cells, because I need to enter the string notation that is already linked to the TemplateBox tag. I have a way to do it with palettes, but I'm looking for a way to do it with an escape alias and an ActionMenuBox. Here I come across this strange problem.

facility codeThe following example loads the notation package, specifies the style sheet and adds a custom style that is helpful in formatting, and defines a function that takes a list of label / symbol pairs and generates the notation links.

<< Notation`
SetOptions[EvaluationNotebook[], 
  StyleDefinitions -> 
    Notebook[
      {Cell[
         StyleData[StyleDefinitions -> 
         FrontEnd`FileName[{"Report"}, "StandardReport.nb", 
         CharacterEncoding -> "UTF-8"]]],
cell[StyleData["chemical"], StyleMenuListing -> None,
TagBoxOptions -> {SyntaxForm -> "Icon"},
ShowStringCharacters -> False, ShowAutoStyles -> False,
ZeroWidthTimes -> True,
TemplateBoxOptions ->
{DisplayFunction -> (RowBox[{#}] &)
SyntaxForm -> "Icon"}]}]]Assign labels[list_] : =
block[{}, 
    Do[Notation[DoubleLongLeftRightArrow[
      ParsedBoxWrapper@TemplateBox[{"""<>list[[i,1]]<> "" "},
"chemical", workable -> wrong, selectable -> wrong],
ParsedBoxWrapper @ SymbolName[list[[i, 2]]]]],
{i, length[list]}];]

The pallet version that worksTo give you an idea of ​​what I want to achieve, here's a palette for inserting the labeled labels:

ChemPalette[name_, list_, width_] : =
Create range[Multicolumn[PasteButton @@@ list, width],
WindowTitle -> name]

usage example: The following code assigns eight example labels and generates a palette for their input.

Assignments = {{"!  ( * SubscriptBox[(C), \(6)]) ! 
( * SubscriptBox[(H), (6)] "O", C6H6O}, {"(! 
( * SubscriptBox[(NH), (4)]) !  ( * SubscriptBox[
  ()), (2)]) !  ( * SubscriptBox[(SO), (4)]) ",
Ammonium sulfate}, {"!  ( * SubsuperscriptBox[(SO), (4), 
  ((2)(-))] "", Sulphate}, {"!  ( * SubscriptBox[(H),  
  (2)]) O (g) ", WaterVapor}, {" !  ( * SubscriptBox[( 
  [CapitalDelta]),  (f )]) ! \ ( * SubsuperscriptBox[(H), 
  (*SubscriptBox[(H), (2)] O  ((g) ),  (o )]) ",
[CapitalDelta]fHWaterVapor},  {"!  ( * SubsuperscriptBox[
  (k), (sq), SubscriptBox[(C), (60)]]\) ", ksqC60},
{"!  ( * SubsuperscriptBox[([Null]),  (6 ), \ (12 )] "C",
Carbon12}, {"[!(*SuperscriptBox[(H), 
  (+)])]", HplusConc}};

In Mathematica, the code looks like this:

Enter the image description here

And then:

Assign labels[assignments];
ChemPalette["Example", assignments, 3];

This creates a palette that looks like this:

Enter the image description here

I can then use this palette to enter one of my labels, and my input cells (and the resulting output cells) look like a standard chemical notation.

The ActionMenu version: I tend to prefer keystrokes to palette input, and have been looking for ways to do the same thing on keyboard. Based on a suggestion by Carl Woll for this thread I have tried the following:

EscMenu[shortcut_, title_, list_] : =
AddInputAlias[
    shortcut -> 
      ParsedBoxWrapper[ActionMenuBox[title, 
        (ToBoxes[#2] :> NotebookWrite[EvaluationBox[],
ToBoxes @ # 2]) & @@@ list,
Appearance -> "PopupMenu", AutoAction -> True]]]EscMenu["chem", "Example", assignments]

This does exactly what I want (well, mostly … bonus question to refine it below), with the exception that all menu items are displayed blank until the mouse pointer moves over them (as shown in the question above). Any ideas?

Bonus Question: This approach still requires the mouse. What would be really nice would be if the Esc-chem-Esc sequences then followed the selection of options with the arrow keys rather than having to use the mouse. Any ideas on how to do that?

magento2 – Custom offer product weight set

I'm trying to set a custom product weight based on a custom product option.
I've tried several things like a plugin, before / after events, actual events like sales_quote_add_item etc.

I can adjust the product weight during these operations, but once I've calculated the shipping costs, it seems like loading the original product weight, not the weight from the system quote_item Table.

At this point, I have removed everything except the one sales_quote_add_item Code.
Any help is appreciated, and thanks in advance.

categories – to display the category of a specific custom contribution type

I apologize for my English but I am French. In my custom search page, I display the results of my custom post type and everything is fine. Only I want to display the category that belongs to it above the custom post type. To view the post categories:

                <? php $ category = get_the_category (); echo "

Category: ". $ [0] -> cat name. "";?>

But as for custom post type?
Thank you for your help.

Visualization – How to display name and date in a custom map, using GeoRegionValuePlot

How do I display the name of each area and data / values ​​(even customizing the text style to fit different sizes)? View all data, not just when the mouse is in a region.

Or how to add and use names
GeoLabels-> True


Geometry data available at https://we.tl/t-NqBdMYcOSN

Geom = union[Import["Estrada.shp", {"SHP", "Data"}]]["Geometry"] /.Polygon[x_] :> (Polygon[GeoGridPosition[#, "UTMZone29"] & / @ x]);
Values ​​= RandomInteger[20, 51];
parroquiasss = {"Agar", "Aguións", "San Pedro de Ancorados",
Santo Tomé de Ancorados, Arca, Arnois, Baloira, Barbude,
"San Miguel de Barcala", "Barcala", "Berres", "Callobre",
San Miguel de Castro, Cereixo, Codeseda, Cora, Couso,
Curantes, A Estrada, Frades, Guimarei, Lagartóns,
Llamas, Liripio, Loimil, Matalobos, Moreira, Nigoi,
Oca, Olive, Orazo, Ouzande, Parada, Paradela,
Pardemarín, Remesar, Ribeira, Ribela, Riobó, Rubin,
Sabucedo, Santeles, A Somoza, Souto, Tabeirós, Toedo,
"Santo André de Vea", "San Xurxo de Vea", "San Xiao de Vea",
"Santa Cristina de Vea", "Vinseiro"};

GeoRegionValuePlot[AssociationThread[geom, values], ImageSize - Big

Many thanks for Carl Lange for the previous help with the link description here

Loading data from a shapefile

Note1.- I think that MAthematica is placed in the middle of each region.

Note2.- I think the mathematical documentation would be so helpful. Typically, the help is information that is automatically contained in Mathematica.

Plugins – After the short code attribute, an extra comma is displayed when you create a custom Gutenberg block

I've created a Gutenberg block that returns the shortcode in the RawHtml component. However, if you return the dynamic shortcode in the edit () function, additional commas are inserted into the shortcode. Anyone can lead me to where I am wrong:

My code:

block.js

const {__} = wp.i18n;
const {registerBlockType} = wp.blocks;
const {fragment, RawHTML} = wp.element;
const {InspectorControls, MediaUpload, AlignmentToolbar, InnerBlocks,
PanelColorSettings, RichText, PlainText} = wp.editor;
const {ToggleControl, RangeControl, SelectControl, Button,
TextControl, PanelBody} = wp.components;

registerBlockType ("stripe-payment-button / rnk-stripe-donate"
Click & # 39; {
title: & # 39; Stripe Donate Button & # 39 ;,
Category: & # 39; RNK Strip Donation Button & # 39 ;,
Keywords: [('stripe'),('donate button'), ('donate')],
Symbol: "money",
Attributes: {
secret key: {
Source: & # 39; attribute & # 39 ;,
Selector: & # 39; .rnk_stripe_secret_key & # 39 ;,
Type: & # 39; string & # 39 ;,
Attribute value & # 39;
},
publishable_key: {
Source: & # 39; attribute & # 39 ;,
Attribute value & # 39 ;,
Type: & # 39; string & # 39 ;,
Selector: & # 39; .rnk_stripe_publishable_key & # 39;
},
Amount: {
Source: & # 39; attribute & # 39 ;,
Attribute value & # 39 ;,
Enter number & # 39 ;,
Selector: & # 39; .rnk_stripe_payment_amount & # 39 ;,
Default: 10
}

},
edit: (props) => {
const {attributes: {secret key, public key, amount},
setAttributes, className} = props;
const onChangeSecretKey = (newSecretKey) => {
setAttributes ({secret_key: newSecretKey});
};
const onChangerPublishableKey = (newPublishableKey) => {
setAttributes ({publishable_key: newPublishableKey});
};
const onChangerAmount = (newAmount) => {
setAttributes ({amount: newAmount});
};
return[
(
            
                
                     
                         
                         
                         
                        setAttributes ({secret_key: value})}
/>
                     
                        setAttributes ({publishable_key: value})}
/>
                         
                            setAttributes ({amount: value})}
/>
                
            

    

    

    

    )
(
        
    [rnk_stripe_payment_block amount="{amount}"]
    
    )];
},
save: (props) => {
Return(
    
    [rnk_stripe_payment_block]
    



);
},
});

Short code in function.php

add_shortcode (? rnk_stripe_payment_block ?,? rnk_stripe_payment_block_function & # 39;);

Function rnk_stripe_payment_block_function ($ atts) {
$ atts = shortcode_atts ([
        "amount" => 1000,
        "publishable_key" => '',
        "secret_key" => ''
], $ atts, & # 39; rnk_stripe_payment_block & # 39;);
$ amount = isset ($ atts['amount']) $ atts['amount'] : & # 39; 1000 & # 39 ;;
$ publishable_key = isset ($ atts['publishable_key'])
$ atts['publishable_key'] : & # 39; & # 39 ;;
$ secret_key = isset ($ atts['secret_key']) $ atts['secret_key'] : & # 39; & # 39 ;;
$ amount = $ amount * 100;
$ url = plugins_url (& # 39; rnk-stripe-payment-button & # 39;);
$ stripe = array (
& # 39; # 39 & secret_key; => $ secret_key,
& # 39; # 39 & publishable_key; => $ publishable_key,
);
Stripe :: setApiKey ($ stripe['secret_key']);
ob_start ();
?>



    



<? php
return ob_get_clean ();
}

In the editor, what I get is:
Enter the image description here

what's in editor my block like this:

[rnk_stripe_payment_block amount=",10,"]

It should look like this (without a comma in the parameter):

 [rnk_stripe_payment_block amount="10"]

Let me know if I'm doing something wrong.

Append a custom field to post content

I'd like to append my custom field named LINK (example: http://domain.com&#39;) to the end of the post so I can use a standard theme again.

Apparently, this answer to the question "mass shift (or copy) from a custom field to the post content?" That's what I need except that it replaces all the post content instead of attaching it.

Can someone help me to change this code to attach it to the post content?

add_shortcode (& # 39; update-posts-from-custom-fields & # 39 ;, & # 39; upfc_fields321 & # 39;);
Function upfc_fields321 () {
$ args = array (
& # 39; # 39 & meta_key; => & Custom_field & # 39 ;,
& # 39; # 39 & meta_query; => array (
Array (
& # 39; key & # 39; => & Custom_field & # 39 ;,
& # 39; value & # 39; => & # 39 ;,
& # 39; compare & # 39; => & # 39; = & # 39 ;,
)
)
& # 39; # 39 & POST_COUNT; => & # 39; -1 & # 39;
);
$ the_query = new WP_Query ($ args);

if ($ the_query-> have_posts ()) {
$ post_counter = $ save_counter = $ delete_counter = 0;
while ($ the_query-> have_posts ()) {
$ the_query-> the_post ();
global $ post; // not sure if this is needed, but it can not hurt
Echo & # 39;
        

& # 39 ;. the title() . & # 39;

& # 39 ;. the content() . & # 39;
& # 39 ;; $ post_counter ++; $ post-> post_content = get_post_meta ($ post-> ID, & # 39; custom_field & # 39 ;, true); $ post-> post_content_filtered = & # 39; & # 39 ;; $ post-> post_excerpt = & # 39; & # 39 ;; // uncomment the next line if you want to make changes // wp_update_post ($ post); $ save_counter ++; // uncomment the next line if you want to delete the meta key (useful if you have too many posts and want to batch them). // delete_post_meta ($ post-> id, & # 39; custom_field & # 39;); $ delete_counter ++; Echo & # 39;
& # 39 ;. the content() . & # 39;
& # 39 ;; } } else { // No entries found }; echo & # 39;
Processed Posts: & # 39 ;. $ post_counter. & # 39;
Saved Posts: & # 39 ;. $ save_counter. & # 39;
Meta deleted from: & # 39 ;. $ delete_counter. "Contributions"; wp_reset_postdata (); }

iframe – Add basic custom HTML

I'm trying to add a weather forecast to my Sharepoint homepage, but it's not working. I use sharepoint online and a modern page. I'm trying to add the following code to the "embed" app.