Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Magento 2 file templates
<?php
namespace ${NAMESPACE}\{$EXTENSION_NAME}\Console\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class ${COMMAND_NAME}Command
*/
class ${COMMAND_NAME}Command extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
/**
* See for more info
* http://symfony.com/doc/current/components/console/introduction.html
* or
* https://github.com/magento/magento2-samples/tree/master/sample-module-command
*/
$this->setName('${COMMAND_NAME_NAMESPACED}')
->setDescription('${COMMAND_DESCRIPTION}');
parent::configure();
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
}
}
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default"> <!-- other value is index for indexer crons -->
<job name="${JOB_NAME}" instance="${CRON_CLASS}" method="${METHOD}">
<schedule>*/5 * * * *</schedule>
</job>
</group>
</config>
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\Console\CommandList">
<arguments>
<argument name="commands" xsi:type="array">
<item name="${UNIQUE_IDENTIFIER}" xsi:type="object">${CLASS_TO_YOUR_COMMAND}</item>
</argument>
</arguments>
</type>
</config>
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="${CLASS_TO_APPLY_PLUGIN_ON}">
<plugin name="${PLUGIN_NAME}" type="${CLASS_OF_PLUGIN_ITSELF}" sortOrder="100" disabled="false" />
</type>
</config>
{
"name": "${LOWERCASE_MODULE_NAME}",
"description": "N/A",
"require": {
"php": "~5.5.0|~5.6.0|~7.0.0",
"magento/theme-frontend-blank": "100.0.*",
"magento/framework": "100.0.*"
},
"type": "magento2-theme",
"version": "100.0.3",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"${NAMESPACE}\\\\${MODULE_NAME}\\": ""
}
}
}
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'frontend/${VENDOR_NAME}/${THEME_NAME}',
__DIR__
);
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="logo">
<arguments>
<argument name="logo_file" xsi:type="string">images/logo.svg</argument>
<argument name="logo_img_width" xsi:type="number">300</argument>
<argument name="logo_img_height" xsi:type="number">300</argument>
</arguments>
</referenceBlock>
</body>
</page>
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>${THEME_NAME}</title>
<parent>${PARENT_THEME}</parent> <!-- Magento/blank is default -->
<media>
<preview_image>${PATH_TO_PREVIEW_IMAGE}</preview_image> <!-- relative from the folder itself -->
</media>
</theme>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment