Skip to content

Instantly share code, notes, and snippets.

@peterjaap
Last active March 2, 2016 16:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterjaap/3e73417ae29e7be9ee77 to your computer and use it in GitHub Desktop.
Save peterjaap/3e73417ae29e7be9ee77 to your computer and use it in GitHub Desktop.
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