magento2 – Render HTML in form_additional_info position in customer edit page

I need to display a custom customer field at form_additional_info position in the edit.phtml template.

The default edit.phml contains this instruction:

<?= $block->getChildHtml('form_additional_info') ?>

So, in my custom customer_account_edit.xml file I had:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="customer_edit">
            <block class="MagentoFrameworkViewElementTemplate"
                   name="form_additional_info"
                   template="Vendor_Core::customer/additionalinfocustomer.phtml"/>
        </referenceBlock>
    </body>
</page>

however, my custom template is not shown.

By seeing the default customer_account_edit.xml file, this is the content:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="customer_account"/>
    <body>
        <referenceBlock name="head.components">
            <block class="MagentoFrameworkViewElementJsComponents" name="customer_account_edit_head_components" template="Magento_Customer::js/components.phtml"/>
        </referenceBlock>
        <referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">Edit Account Information</argument>
            </action>
        </referenceBlock>
        <referenceContainer name="content">
            <block class="MagentoCustomerBlockFormEdit" name="customer_edit" template="Magento_Customer::form/edit.phtml" cacheable="false">
                <container name="form.additional.info" as="form_additional_info"/>
            </block>
        </referenceContainer>
    </body>
</page>

So I thought I should reference customer_edit block and define form.additional.info block inside, but it did not work.

Any help?

javascript – Which of these approaches is better to load and render data in a browser based, turn based game?

I am developing a browser-based, turn-based board game. When a player accesses the page, the game current status is loaded from the database and the board is rendered accordingly. I am not sure which of the following approaches is better. For simplicity, let’s suppose that the only parameter that has to be loaded and rendered is a number that can be either 0 or 1.

Approach #1:

<?php
    $param = load_game_data(); // in the real case, this will be an associative array with many parameters
?>
<html>
<head></head>
<body>
<div id="board">
<!-- html elements related to the board -->
</div>
<script>
// as an example, the loaded data determines the bg color
document.getElementByID("board").style.backgroundColor = 
<?php if($param == 0) echo('"red"'); else echo('"green"'); ?>
;

</script>
</body>

Approach #2:

<html>
<head></head>
<body>
<div id="board">
<!-- html elements related to the board -->
</div>
<script>
$.ajax({
   url: "load_game_data.php",
}).done(function(param){
   if(param == 0)
        document.getElementByID("board").style.backgroundColor = "red";
   else
        document.getElementByID("board").style.backgroundColor = "green";
});
</script>
</body>

What are the pros and cons of the two approaches? What is the standard way to proceed? Note that the user can interact with the board elements (e.g. check information about some of them or change their status) but permanent changes are saved to the DB only when the turn ends.

Render Issues for R Markdown HTML Output to Sharepoint

So I’ve finished a lovely R Markdown script with an HTML output and was excited to share the analysis to colleagues internally, by sharing the Sharepoint link.

The output works fine when I open the HTML file directly on my machine. But for whatever reason, when I share or view via the Sharepoint link, simple things like the TOC, plotly graphs and leaflet maps do not render.

Here’s an example of the problem I’m running into, with some really basic script just as an example.

---
title: "Test_Output"
output: 
  html_document:
    toc: true
    toc_float: true
    
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown
Hello, this is a test.

## Test
```{r test plotly, echo = FALSE, warning = FALSE, message = FALSE}
library(plotly)
plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length)
```

And so this is the output, right.

enter image description here

But when I share the link (something like this https://mycompany.sharepoint.com/:f:/s/mydepartment/EvLlZjmxOetc) or if someone were to try and just navigate to the page on our Sharepoint, the output is all messed up. It looks like this: plots and TOC and maps do not render.

enter image description here

If anyone can help me to figure out how to allow my Markdown HTML output to render instantly once I share the link, that would be incredible, and I would feel like all my work on the script was not in vain!

I’ve tried adding “download=1” to the end of the URL, which indeed gives users an ability to view the output correctly by clicking the link and downloading the HTML, but this is not optimal as this is supposed to be a live product that I will continue updating.

Thanks! C

web – How do the Render Engine and JavaScript Engine Communicate in a browser?

I’m looking for a detailed answer on this.

What I already Know

So I have some understanding about the call stack and callbacks, and that the browser add functionality through web APIs which add callbacks through the event loop. I also read somewhere about the JS engine having an API.

What I want to understand

How are the web APIs exposed to the JS engine? (If this is about the JS engine having an API, some description on how that API works would do)

How can the behavior of the Render Engine be manipulated through JavaScript, like manipulating the DOM, CSSOM etc.? (If I understood correctly, this is the equivalent of asking how web APIs work)

Thanks!

magento2 – How to render related products block using a php script?

I’ve created the below code, but it looks like I’m missing something. Can you help please?

<?php

require __DIR__ . '/../../app/bootstrap.php';
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
/** @var MagentoFrameworkObjectManagerObjectManager $objectManager */
$objectManager = $bootstrap->getObjectManager();

$state = $objectManager->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');

$registry = $objectManager->get('MagentoFrameworkRegistry');
$pageFactory = $objectManager->get('MagentoFrameworkViewResultPageFactory');

$productFactory = $objectManager->get('MagentoCatalogModelProductFactory');
$product = $productFactory->create()->load(143767);
$registry->register('product', $product);
$resultRedirect = $pageFactory->create();

echo $resultRedirect->getLayout()
    ->createBlock("MagentoCatalogBlockProductProductListRelated")
    ->setTemplate("Magento_Catalog::product/list/items.phtml")
    ->setData('type', 'related')
    ->toHtml();

(Magento version is 2.4.2). The problem is:

Fatal error:  Uncaught TypeError: Argument 2 passed to MagentoCatalogBlockProductImageFactory::getLabel() must be of the type string, null given, called in /var/www/html/app/code/Magento/Catalog/Block/Product/ImageFactory.php on line 168 and defined in /var/www/html/app/code/Magento/Catalog/Block/Product/ImageFactory.php:117
Stack trace:
#0 /var/www/html/app/code/Magento/Catalog/Block/Product/ImageFactory.php(168): MagentoCatalogBlockProductImageFactory-&gt;getLabel()
#1 /var/www/html/generated/code/Magento/Catalog/Block/Product/ImageFactory/Interceptor.php(23): MagentoCatalogBlockProductImageFactory-&gt;create()
#2 /var/www/html/app/code/Magento/Catalog/Block/Product/ImageBuilder.php(135): MagentoCatalogBlockProductImageFactoryInterceptor-&gt;create()
#3 /var/www/html/app/code/Magento/Catalog/Block/Product/AbstractProduct.php(518): MagentoCatalogBlockProductImageBuilder-&gt;create()
#4 /var/www/html/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml(216): MagentoCatalogBlockProductAbstr in /var/www/html/app/code/Magento/Catalog/Block/Product/ImageFactory.php on line 117

theming – How can I render the chart inside the container ?

I am running Drupal 9 on Lando. I installed the Charts and the Highcharts modules. I made a custom module with a template file containing the following code.

{# stats_degrees/templates/mychart-template.html.twig #}
{{ attach_library('stats_degrees/highcharts') }}
<h1>My Chart Template</h1>

<div id='container' style='width:100%;height:100%;'></div>

This is the render array output by the controller class.

 // build render array for chart
    $chart = array(
      '#attached' => array(
        'library' => array('stats_degrees/highcharts'),
      ),
      '#theme' => 'mychart_template',
      '#type' => 'chart',
      '#chart_type' => 'line',
      '#chart_library' => 'highcharts'
      '#title' => t($title),
      '#legend_position' => 'right',
    );

I then create the rest of the chart array and return it. The template is rendered with no chart.

How can I render the chart inside the container <div>?

7 – Render form in page–node.tpl.php

I’m trying to render a form in a page template file. The form was created using the Webform module. From what I’ve seen on Google etc. so far, the form needs to be called in the preprocess function in order for the error messages to work.

In the template.php file I have the following code.

function exhibitions_preprocess_page(&$vars) {
  $vars('whales') = drupal_get_form('webform_client_form_23877');
}

I also tried using the following code.

function exhibitions_preprocess_page(&$vars) {
  $node = node_load(23878);
  $vars('whales') = drupal_get_form('webform_client_form_23877',$node,array());
}

In the page–node–23878.tpl.php template file, I added the following code.

<div class="contest">
  <?php print render($whales); ?>
</div>

What might I do wrong?

I’m getting an error message with the first preprocess function.

The website encountered an unexpected error. Please try again later.

With the second preprocess function, I get an empty form.

<form class="webform-client-form" enctype="multipart/form-data" action="/en/exhibitions-galleries/exhibitions/great-whales-up-close-and-personal/rom-great-whales-contest" method="post" id="webform-client-form-23877" accept-charset="UTF-8"><div><input type="hidden" name="form_build_id" value="form--mtMrBb-7ynd8ONTXqQoOLdBlJXXmg3rQ7DsCqCyjWc">
<input type="hidden" name="form_token" value="5yqloy50Kd4ElGDJWpC7GTz8EqLmrjGtXLc2KFlTze0">
<input type="hidden" name="form_id" value="webform_client_form_23877">
</div></form>

8 – How can I render a view as JSON inside a template file?

I would like to render a view as JSON, within the page template. I would hide it with CSS and use it with JavaScript.

Is there a way to alter the Format field used when creating a view, which normally shows options like Grid, HTML List?

I did try the Rest Export core module, but it seems to render the view as JSON with no other page content.

Render image from sub-paragraph in parent-paragraph template?

Render image from sub-paragraph in parent-paragraph template? – Drupal Answers

Photoshop 2018 does not let me do File > Export > Render Video, nothing happens

Please advice I have tried this:

I open an mp4 file and it works ok, it’s parses the mp4 and insert it into the timeline editing view.

Then I go to File > Export > Render Video and nothing happens.
(what I of course want to to here is to add layers on the video when I get the export to work)

I have tried:

  • Reset Photoshop settings(open Photoshop hold down all three Ctrl+Alt+Shift buttons)
  • Turned off in Preferences>performance Use Graphics CPU
  • Created a new User in Windows 10, and in this User account tried the same
  • Checked all Hard Drives for low space
  • I have tried different Mp4, in case it was corrupted

Please advice what’s wrong with Photoshop, why cant I export Render Video an Mp4?

I have this Laptop:
(Asus Rog Gaming laptop high spec)
https://www.prisjakt.nu/produkt.php?p=3369768

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies 5000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive.com Proxies-free.com New Proxy Lists Every Day Proxies123.com Buy Cheap Private Proxies; Best Quality USA Private Proxies