8 – How to place a plugin block to twig template without any contributed module?

I am using Drupal 8. Have created a custom module, added custom block “LskyTestVideo”, created a new page template with its own controller (“LskyOpenTokTestController”). In LskyOpenTokTestController::index action I rendered test-video-page.html.twig . Inside this page I need to place LskyTestVideo block.Here my code:

class LskyOpenTokTestController extends ControllerBase {

public function index() {
$block_manager = Drupal::service('plugin.manager.block');

$config = ();
$plugin_block = $block_manager->createInstance('lsky_test_video', $config);

$access_result = $plugin_block->access(Drupal::currentUser());

if (is_object($access_result) && $access_result->isForbidden() || is_bool($access_result) && 
!$access_result) {
  return ();
$render = $plugin_block->build();

return (
  '#theme' => 'open_tok_test_video_page',
  '#attached' => (
    'library' => (
  '#test' => $render,


Here test-video.html.twig

    <div class="test-video-block">{{ test }}</div>

When the page is rendered, it returns 0.
How I can place a custom plugin block inside twig template. Thanks.

php – Show data obtained from a function and place it in a shortocode function

I don’t really understand what you’re trying to do. Why don’t you just call the function inside the shortcode handler? This looks more like general PHP question.

With modern anonymous functions, you can pass variables using the use keyword.

add_shortcode('operation', function (array $atts, ?string $content, string $shortcode_tag) use ($another_var): string {
    $out = 'The value of my variable is: ' . $another_var;
    return $out;

With ancient named functions as callbacks, you can access a variable in the global scope (defined outside and “above” your callback) by bringing it into your local scope (inside the body of your callback) by using the global keyword:

function shortcode_operation_handler(array $atts, ?string $content, string $shortcode_tag): string {
    global $another_var;
    $out = 'The value of my variable is: ' . $another_var;
    return $out;
add_shortcode('operation', 'shortcode_operation_handler');

Those words before variable names are types for the parameters (more on those in the PHP documentation). The type after the semicolon (:) in the function definition denotes its return type.

encryption – Does PGP passphrase necessary if I store private key and passphrase in the same place?

The benefit of a passphrase is an added layer of protection for your keys assuming that the attacker has no way of associating the passphrase and the key.

Let’s assume an attacker gained access to this vault.

If it has both the passphrase and the key, then it matters not if the passphrase was randomly generated or what, they key is essentially (for lack of a better word) ‘breached’.

If it has only the key with no passphrase, then the same result applies. Your keys are ‘breached’.

If this vault has the keys with a passphrase (which isn’t stored in the same vault), then your keys are a lot safe, and if generated properly, secured.

How do I place a file on my "Origin" server AWS

Akamai is asking me to place a SureRoute file on my origin server. My AWS setup is currently an ELB and multiple EC2 instances and using apache vhosts to route the domains to the correct folders.


Where/how do I place this file if they want it on origin root level?

How to decide which is the best place to start a business ?


My name is THOMAS. I am intending to start my own business but a little bit confused “Where to start it ?”.
Like which is the best place where the expectations are high to run a successful business.
I would be very thankful if an experiences person guides me about this



canada – Where is the best place to talk to truck drivers about helping them out on the road

I’m a veteran and I’m interested in the life of her the road trukingIm writing a book on the life of working people in this country,especially truck drivers they are least appreciated, especially veterans..

magento2 – Magento 2 redirection problem after place order on google chrome

I’ve developed a payment method on Magento 2.3. Here’s how it works: after clicking on the “place order” button, I create the order and no matter the result of the order creation operation (success or failure), I stay on the payment page. This mechanism works well on mozilla firefox, however on chrome and opera, the redirection is automatic.

I set redirectAfterPlaceOrder to false, but on chrome and opera, the redirection is automatic, unlike mozilla firefox, which sticks to it. Please, would you know how to fix this problem?

defaults: {
    redirectAfterPlaceOrder: false,
    template: 'Test_Payment/payment/testpayment'
     * Place order.
    placeOrder: function (data, event) {
        var self = this;

        if (event) {

        if (this.validate() && additionalValidators.validate() && this.isPlaceOrderActionAllowed() === true ) {

                    function (data) {

                        if (self.redirectAfterPlaceOrder) {
                    function (data) {
                    function () {

            return true;

        return false;

PS: the code I used for placeOrder() is entirely magento’s code with a small modification to the line where I call the afterPlaceOrder() function to which I send a parameter at the call.

7 – How can i set an error message in the right place?

Using Webform with custom template, and this code.
I have code below for validation and validation errors, and it works fine. But errors always appear in wrong place.

I think the problem is with $element, but I’m not sure.

some example html

<form id="webform_client_form_226">
<div class="catalogue__form-input-inner">
    <div class="catalogue__form-input">
        <div class="form-item">
            // i need it here
            <label for="edit-submitted-vashe-imya--3">Your name</label>
            <input name="submitted(vashe_imya)" value="" size="60" maxlength="128" class="form-text error">
    <div class="catalogue__form-input">
        <div class="form-item webform-component webform-component-textfield webform-component--nomer-telefona webform-container-inline">

            // and here

            <label>Phone number</label>
            <input name="submitted(nomer_telefona)">
    <div class="catalogue__form-button">

    // always appears here right now

        <div class="form-actions">
            <input name="op" value="send"></div>        

and template.php

function pkpro_uikit_form_alter(&$form, &$form_state, $form_id) {
    // Check the form id
    if($form_id == 'webform_client_form_226') {
    $form('#validate')() = 'form_validate';
    function form_validate(&$form, &$form_state) {
    $message = "Field required";
    if(isset($form_state('values')('submitted')('vashe_imya'))) {
    $name = $form_state('values')('submitted')('vashe_imya');
    if( condition ) {
    form_error($form('submitted')('vashe_imya'), $message);
    if(isset($form_state('values')('submitted')('nomer_telefona'))) {
    $name = $form_state('values')('submitted')('nomer_telefona');
    if( condition ) {
    form_error($form('submitted')("nomer_telefona"), $message);
      // get all validation errors. 
      $form_errors = form_get_errors();
      if (!empty($form_errors)) {                                //i think
        foreach ($form_errors as $element => $error) {           //the problem is here
          $form($element)('#suffix') = '<div>'.$error.'</div>';  //but not sure. Trying changing this for 2 days(
      // clear default error messages.

Help, pls)

Where is the nbest place to talk to.truck drivers about helping them out on the road

I’m a veteran and I’m interested in the life of her the road trukingIm writing a book on the life of working people in this country,especially truck drivers they are least appreciated, especially veterans..

I cant able to place the order in magento 2

enter image description here
**I cant able to place the order ** https://prnt.sc/t57wsd How to fix this