8 – Custom form returns NULL in custom template

I have a couple things:

-A custom form

-A custom theme

-A custom module for this form

I am trying to get the custom form to display on a custom template which is in a custom theme.

structure for custom module called weeks:











this is what FormWeeks.php looks like


namespace DrupalweeksForm;
use DrupalCoreFormFormBase;
use DrupalCoreFormFormStateInterface;

class WeeksForm extends FormBase {
   * {@inheritdoc}
  public function getFormId() {
    return 'weeks_form';

  public function buildForm(array $form, FormStateInterface $form_state) {
    $form('#theme') = 'weeks_form';
    $form('deactivate') = array(
        '#type' => 'submit',
        '#value' => $this->t('Deactivate'),
        '#name' => 'deactivate',
    $form('2_week_pause') = array(
    '#type' => 'submit',
    '#value' => $this->t('Pause for 2 weeks'),
    '#name' => 'pause'
    $form('start_again_week_1') = array(
    '#type' => 'submit',
    '#title' => $this->t('Start again at week 1'),
    '#name' => 'restart_week_1',
    return $form;

   * {@inheritdoc}
  public function submitForm(array &$form, FormStateInterface $form_state) {

     $action = $form_state->getTriggeringElement()('#name');
     $user = Drupal::currentUser();
     if($action == 'deactivate'){
        $user->set('field_52_weeks', $action);
     }else if ($action == 'restart_week_1'){
        $user->set('field_current_week', 1);
     } else if ($action == '2_week_pause'){
        $user->set('field_52_weeks', $action);


This is what is in weeks.module

function weeks_theme($existing, $type, $theme, $path){
    return (
        'weeks_form' => (
            'render element' => 'form',
            'template' => 'html--52weeks',

this is what weeks.routing.yml looks like

  path: '/52weeks'
    _title: '52 weeks'
    _form: 'DrupalweeksFormWeeksForm'
    _permission: 'access content'

I have a twig file in themes/custom/mytheme/templates called html–52weeks.html.twig. This is whats in there:

{{ dump(form) }}

that ^^ returns null and I have no idea why. I’ve tried changing the $form(‘#theme’) = ‘mytheme’, in WeekForm.php, but this still doesnt work. What I want is for this form to be displayed when someone goes to the /52weeks url. The main problem is that the form does not get passed to the template

magento2 – Magento 2 : shipped items not appearing in email template

{{layout handle="sales_email_order_shipment_items" shipment_id=$shipment_id order_id=$order_id}}

is used to render shipped items in email template but no items appear in email template.

I had also set “is_legacy” to 1 in email_template table.

Any thoughts, what can be the issue ?

I am using Magento/2.4 (Enterprise)

views – Template suggestion does not work for table in a custom block / Might there be a way around?

I created a block on pages of the “Author” content type that lists all the articles the author has contributed to in a table (via contextual filter). Now I want to customize the table layout. I already did this before in a similar case, where I show the table on a page, not in a block. There I get file name suggestions for the template inside HTML comments like that:

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view_table__articles' -->
   x views-view-table--articles.html.twig
   x views-view-table--articles.html.twig
   * views-view-table.html.twig
<!-- BEGIN OUTPUT from 'themes/MYTHEMEFOLDER/templates/views/views-view-table--articles.html.twig' -->

But in my latest case, the table in a block, I only get this suggestion:

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view_table' -->
<!-- BEGIN OUTPUT from 'themes/MYPARENTTHEMEFOLDER/templates/views/views-view-table.html.twig' -->

Note that it outputs the template of my parent theme, not my actual theme.

I did some research and found this issue, which currently is not resolved and the proposed patch not included inside the Drupal code. Is this the reason I cannot create a custom template or is there something else I can do?

If not, how would I create that table of referenced articles on the author’s page?

theme development – How to create code template to promote products inside WordPress post

I want to suggest products inside a post content, something similar to the wirecutter style, but I don’t how to get started without using a plugin.
Does anyone have any idea what would be the best approach to get this done?
The product promotion has to include product name, subtitle, description, image, and button with the link to the product.

sharepoint online – How to truncate string inside modern search template handlebars

You need to create a custom handlebar helper to truncate the string.


public registerHandlebarsCustomizations(namespace: typeof Handlebars) {
    namespace.registerHelper('trimString', function(passedString, startstring, endstring) {
        var theString = passedString.substring( startstring, endstring );
        return new namespace.SafeString(theString)

Then, in template, you can use it like:

<p>{{{trimString value 0 50}}}</p>


  1. Register Handlebars customizations
  2. Handlebars – substring

Users are saving over a fillable template and wrecking the original

We have a template that users need to modify and return as an attachment but they are modifying the original and saving it which then leaves their info for the next user. How do we stop this? They do need to complete the form (so it can’t be read only) – but not save back over the original.

Thanks in anticipation

i will design responsive wordpress website with any template for $50

i have 1 year experiesce , to create responsive wordpress website . i can create a amazing website for your business and institutions .

by: Mokaddesh
Created: —
Category: WordPress
Viewed: 96


magento2 – Magento 2 : how to show custom shipping address in email template?

I am trying to send & show custom shipping address on email template

here is the code

            $ship_country_id = "US";
            $ship_region_id = "CA";
            $ship_region = "12";
            $ship_street = "780 N. Yup Tea";
            $ship_city = "Los Angeles, California";
            $ship_postcode = "9001";

                $ship_firstName = $email_pickup_data('pickupName');
                $ship_lastName = "";
                $ship_telephone   = $email_pickup_data('pickupPhone');
                $sales_la_order_address_ship = array(
                    'region_id' => $ship_region_id,
                    'region' => $ship_region,
                    'postcode' => $ship_postcode,
                    'street' => $ship_street,
                    'city' => $ship_city,
                    'telephone' => $ship_telephone,
                    'country_id' => $ship_country_id,
                    'address_type' => 'shipping',
                    'firstname' => $ship_firstName,
                    'lastname' => $ship_lastName,
                    'middlename' => "",
                    'email' => "",
                    'fax' => "",
                    'status' => 0,
                    'pickupPhone' =>$email_pickup_data('pickupPhone')

            $transport('la_pickup_address') = $sales_la_order_address_ship;
            $transportObject = new DataObject($transport);

But in email template when i use {{ var la_pickup_address }} it shows error

Any thoughts on this ?

theming – How to create template suggestion for image like IMAGE–BLOCK-TYPE or IMAGE–FIELD-TYPE

I’m struggling to make template suggestions like IMAGE–BLOCK-TYPE or IMAGE–FIELD-TYPE.
I have three different block types(image1, image2, image3) with one image field(field_image_1, field_image_2 and field_image_3).
And I don’t know how to get suggestion like








my_theme_suggestions_image_alter(array &$suggestions, array $variables)


Please help!

Template Literal as a function argument in Typescript

Given the example below:

type AllNames = 'andre' | 'willian' | 'pedro'
type HiNames = `Hi ${AllNames}`

const value: AllNames = 'andre'

const randomFunction = (prop: HiNames) => `${prop}, how are you?`

randomFunction(`Hi ${value}`)

VSCode is throwing the following error :
Argument of type 'string' is not assignable to parameter of type '"Hi andre" | "Hi willian" | "Hi pedro"'.

Wouldn’t Hi ${value} always evaluate to Hi andre?

How could I use a template literal as a function argument in Typescript? Any help is highly appreciated. Thanks.