Jawaban:
Tambahkan blok baru dengan membuat modul baru. sebagai contoh :
Buat direktori baru di app/code/
Dalam hal ini buat folder lain Foo/Bar
Untuk membuat modul, buat module.xml di Foo/Bar/etc/module.xml.
Dan rekatkan kode ini
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Foo_Bar" setup_version="2.0.1"/>
</config>
Jalankan ini php bin/magento setup:upgradedi CLI Anda untuk membuat modul.
Membuat Foo/Bar/Block/Baz.php
dan rekatkan kode ini
<?php
namespace Foo\Bar\Block;
class Baz
extends \Magento\Framework\View\Element\Template
{
public function getTitle()
{
return "New Block";
}
}
membuat Foo/Bar/view/frontend/layout/customer_account_login.xml
dan rekatkan kode ini
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Foo\Bar\Block\Baz" template="Foo_Bar::default/baz.phtml"/>
</referenceContainer>
</body>
</page>
membuat Foo/Bar/view/frontend/templates/default/baz.phtml
dan rekatkan kode ini
<?php
?>
<h1tag><?php echo $block->getTitle(); ?></h1tag>
Hapus cache dan periksa blokir Anda dengan memuat ulang halaman login.
Tambahkan melalui widget, Tambahkan widget baru tipe blok statis CMS dan daripada di opsi widget pilih halaman spesifik Anda.