magento2 – The block is not displayed after loading the page

Please help solve this puzzle.
I’m created after plugin, after load category widget. The collection of items must be used in the js. The idea is to simply intercept the collection in the plugin, load it to the front in the .phtml template and process it in it. My plugin code
ParceWidget.php

namespace VendorModulePlugin;

use MagentoFrameworkViewElementTemplate;

class ParceWidget
{
    protected $blockFactory;

    public function __construct(
        MagentoFrameworkViewElementBlockFactory $blockFactory
    ) {
        $this->blockFactory = $blockFactory;
    }

    public function afterCreateCollection(
        MagentoCatalogWidgetBlockProductProductsList $subject,
        $itemsCollection
    ) {
        $this->parceWidgetInformation($itemsCollection);

        return $itemsCollection;
    }
    
    protected function parceWidgetInformation($itemsCollection)
    {
        $block = $this->blockFactory->createBlock(
            Template::class,
            (
                'data' => (
                    'widget_items' => $itemsCollection
                )
            )
        )
            ->setTemplate('Vendor_Module::widget.phtml');

        $block->setNameInLayout('vendor.module.widget');
        $block->toHtml();
    }
}

widget.phtml

<div>
    <?php if ($items = $this->getData('widget_items')):?>
        <?php //var_dump($items); die();?>
        <?php foreach ($items as $item): ?>
            <ul>
                <li><?= $item->getData()?></li>
            </ul>
        <?php endforeach;?>
    <?php endif;?>
</div>

I have omitted some of the standard points, leaving the gist.
So, if you write any content in widget.phtml, then at the end of loading the page on the front will not be displayed. But if you stop the download page process by doing for example:
<?php var_dump($items')); die();?>
In this case, everything will be in place. Here I have a question, where does the data disappear in the process of loading the page, because you can see that the template is loaded and the data can be obtained in it?

How to increase block width for Twenty-Nineteen theme?

Stack Exchange Network


Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

What pools will allow asic block erupters these days?

Fellow miners, kind Sirs,

Im a Ubuntu cgminer/bfgminer guy and purchased 6 asic block erupters and a newbee to mining. Could never get into slushpool, but have been mining for poolin for about a week and really dont see any results anywhere.

1-poolin.com? – I did create for ETH, a coinbase wallet entry, although the poolin ‘sub-account’ dialog field never showed the pasted wallet address and still see nothing where it doesnt even show the hash rate. Possibly Im not looking in right place and/or this hardware isnt making any kind of contribution even though the terminal screen shows the miners cranking away full speed, now for some days.

2-other pools? – I have been reading and realize that block erupters are now considered too slow or inadequate for most pools. Does anybody recommend of know of a pool where 6 block erupters could make an acceptable contribution and they would allow little me to mine and see the results of dedicated mining hours?

Certainly I do plan to enlarge this configuration but would be very grateful to see some results before making more investment. Again thanks kindly for your assistance. ]]

theming – How to style Search API search block to look like the default?

I’m using Drupal 9.0.8 with W3CSS THEME FOR DRUPAL (8 & 9) ⚡️ and Search API & Search API Pages modules.
Having removed the core Search module I am now using the search block provided by the Search API Pages module. I would like to style this search block to look more like the one removed with the core module, with the inline search button and FontAwesome icons but I don’t know where to begin. I can’t even find the CSS that styled the original search block to crib it. Please can anyone point me in the right direction?
Thanks.

transactions – Why does the txn_count field exists in a block?

I was wondering why the txn_count field in a block exists. The count of transactions could be determined by parsing the txns field in tx format, right?

Yes, it could, but it isn’t. Ultimately serialization formats are a convention, and Satoshi picked one when he created the initial software which has persisted in the protocol. It could be changed, but why bother?

The tx_in and tx_out can be just parsed and the count can be determined based on that, right?

That’s not quite true – you need some way of conveying at least where the inputs end and the outputs begin (which in the existing protocol is served by the txin count). When deserializing a list of transactions (like in a block message), you also need to know where each transaction ends and the next one begins (which in the existing protocol is served by the txout count).

Is it also used so you can reserve a certain amount of memory before parsing the transactions you think?

You could, but that actually isn’t done (at least in Bitcoin Core). The problem is what if you receive a block that claims to contain a billion transactions? Instead, it will allocate buffer space in increments of at most a few MB, so an attacker would need to actually send megabytes of data to get you to allocate that much.

block editor – WordPress giving size-large class to post images automatically as default (even if large size is unavailable)

I discovered weird wordpress behavior – wordpress automatically adds size-large class to newly added post images.
Even if image is too small and big size wasn’t generated by wordpress it gives that size-large class.

For example right now I have image which is too small even for “thumbnail” and “medium” size to be generated (only “Full size” is available in image size dropdown in gutenberg post editor, which is actually smaller than “thumbnail”) and wordpress gives it size-large class anyway.

Seems like this weird behaviour occurs when image is too small for certain sizes to be generated.
How can I solve this problem? “Full size” should be the option that always works anyway.

Right now I have “thumbnail” size set to be 850px wide, uploaded picture 800px wide so thumbnail and any other default wordpress sizes weren’t generated. The image has only full-size option available, but class is set to size-large anyway… I’m sure it’s not plugin related problem.

What the… ?

Relative date filter views block is cached for anonymous users

Drupal 7.74, views 3.24 (latest)

I have a view which uses a date field to filter and shows on: less than or equal to “now”

I display the view in a block.

With caching for anonymous enabled, (caching blocks disabled), the view block is not shown when the date has passed (works for authenticated users)

Is this normal behaviour, am I missing something, or do I need to disable caching for the pages this block will appear on?

Thanks!

bitcoin cash – Allowip block local cli command?

I am new to bitcoin node, recently I tried to running my node with rpcbind and rpcallowip, with the setting of rpcbind and rpcallowip, I am not able to stop the node with locall cli…

error: server returned HTTP error 403

it returning a 403 forbidden when I execute command.

Any idea how can I stop the node if I am not able to send command from the allowip…

8 – Hide block on 404 (not found) page

The easiest way would be to redirect to the default 404 page instead of throwing an exception.

You can easily do it like this :

use DrupalCoreUrl;
use DrupalviewsViewExecutable;
use SymfonyComponentHttpFoundationRedirectResponse;

function mymodule_views_pre_render(ViewExecutable $view) {
  if ($view->current_display == 'page_machine_name' && empty($view->result)) {
    $url = Url::fromRoute('system.404');
    $response = new RedirectResponse($url->toString());
  }
}

theming – render field of a “node_view” array in block twig in Drupal 9

I want to render a field called ‘field_address’ (text field) in a block twig. The node is loaded in theme preprocess

I know, I can print the field value by node object:

{{ front_nodeObj.field_address.entity.field_address.value }}

but I want to print in the correct actually used language and with the label, as it is given at node display in admin…. and without twig_tweak etc. additional modules

Drupal 9 code in mytheme.theme:

function mytheme_preprocess(&$variables, $hook)

  $front_nid = 3;
  //node_load
  $front_nodeObj = DrupalnodeEntityNode::load($front_nid);  
  //node_view
  $front_content = Drupal::entityTypeManager()->getViewBuilder('node')->view($front_nodeObj);

  $variables('front_nodeObj') = $front_nodeObj;
  $variables('front_content') = $front_content;
}

Drupal 9 block.html.twig:

{{ front_content('#node').field_address }} ???

Drupal 7 code would be:

<?php
  $nid = 3;
  $nodeObj = node_load($nid);
  $content = node_view($nodeObj, 'full');

  print render($content('field_address'); //how to do this on Drupal9?
?>

Thank you 🙂