Type of control for a non-interactive widget

I have a set of inputs whose type can be changed, and one of the input types is read-only. What’s the best way to represent this in a cross-platform manner?

Right now I went with a disabled button which looks like the following:

Ubuntu:

Ubuntu rendering

macOS:

macOS rendering

Windows:

gif displaying the example

I understand a disabled button is a bit misleading as the semantics imply it could be enabled and interacted with. I’m abusing it for it’s aesthetics.

For reference I’m using the Qt framework.

File widget custom upload location

I am working on a custom module (based on Model project) with a file field attached to my custom entities, now I would like to save files in certain directories according to entity id eg:

public://files/my_custom_entity_ID/filename 

I’ve tried with hook_file_insert but can’t get the entity id in order to use it later in file_move.

Which hook (if any) should I use? Or I am missing the whole approach?

Increase engagement with recommendation widget

Hey all,

I've built a recommendation widget tool called OrbitsApp that encourages readers to stay on your blog by recommending what to read next. You can check it out here: https://orbitsapp.com

Is this something you would be interested in trying? If yes, I can set up a quick demo page for your blog to show how it would look like.

Best,
Baha

Magento 1 widget structure

I want to create a widget which I am gonna use it as an advertising banner. I followed this tutorial widget. The thing is (in this tutorial and all the rest that I was able to find) there was not a specified a template in the widget. And I don’t know how can I place it in the footer. I would like to know more about how to create, use and where to place a widget.

Magento 2 Confirmation widget confirm action

I’m trying to execute a function on confirm widget confirmation, but the confirm action is firing on load page always.

Here is the HTML:

<a class="action accept" id="accept_user" href="#">     <span>         <?php /* @escapeNotVerified */ echo __('Accept'); ?>     </span> </a> 

And Here the JS:

<script> require([         'jquery',         'Magento_Ui/js/modal/confirm'     ],     function($  , confirmation) {         $  ('#accept_user').on('click', function (e){             e.preventDefault();             confirmation({                 title: 'Accept user',                 content: 'Do you want to accept this user?',                 actions: {                      confirm: function () {                         <?php /* @escapeNotVerified */ echo $  block->activateUser('$  userId'); ?>                     },                      cancel: function () {                         return false;                     }                 }             });         });     }); </script> 

How to execute the confirm action only when user click on Accept button from confirmation modal?

It’s for frontend area.

Thank you!!

Add Padding to Image Crop Widget

I’m using Image Crop Widget (8.x-2.2) and Crop API (8.x-1.5).

I’m trying to add “padding” to the cropping area so that I wouldn’t have to cut my images at awkward places.

For example, with an aspect ratio of 4:3 and an image of 1000px wide and 200px hight, how could expand the cropping selection include the entire image? (By adding empty space to the top and bottom of the image?)

Hopefully, the colour of this added space, or padding, would be white, (or customizable).

Magento 2.2: How to remove add_to_wishlist button from, and add SKU view in, recently viewed products widget in module

I want a extra tab on product page with 4 previously viewed products. Besides that I want to remove “add_to_cart,add_to_compare,add_to_wishlist” buttons and add SKU attribute to recently viewed products in my module.

Probably not the right approach, but I do get 4 recently viewed Products. I have this code now:

Knot\PreviousTab\registration.php

<?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::MODULE, 'Knot_PreviousTabPDP', __DIR__ ); 

Knot\PreviousTabPDP\etc\module.xml

<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">     <module name="Knot_PreviousTabPDP" setup_version="1.0.0">     </module> </config> 

Knot/PreviousTabPDP/view/frontend/layout/catalog_product_view.xml

<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body>     <referenceBlock name="product.info.details">         <block class="Knot\PreviousTabPDP\Block\PreviousProductsTab" name="previous_products.tab" as="previous_products_tab" template="Knot_PreviousTabPDP::previous_products.phtml" group="detailed_info">             <arguments>                 <argument name="title" translate="true" xsi:type="string">Previous Products</argument>             </arguments>         </block>     </referenceBlock> </body> 

Knot/PreviousTabPDP/view/frontend/templates/previous_products.phtml

<?php  echo $  this->getLayout() ->createBlock("Magento\Reports\Block\Product\Widget\Viewed") ->setDisplayType("recently.view.products") ->setPageSize("4") ->setTemplate("widget/viewed/content/viewed_grid.phtml")->toHtml() ; ?> 

and a empty

Knot/PreviousTabPDP/Block/PreviousProductsTab.php

<?php  namespace Knot\PreviousTabPDP\Block;  use Magento\Catalog\Model\Product;  class PreviousProductsTab extends \Magento\Framework\View\Element\Template {  }