Just put it under your templates folder inside your
Last active
February 22, 2018 15:27
-
-
Save gogl92/dc2a17e8db0adf13b6ef04956d1b9e4a to your computer and use it in GitHub Desktop.
PHPStorm Yii2 Live Templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<templateSet group="Yii"> | |
<template name="yrnd" value="return $this->render('view');" description="Yii2 Render View" toReformat="false" toShortenFQNames="true"> | |
<context> | |
<option name="PHP" value="true" /> | |
</context> | |
</template> | |
<template name="yaction" value="public function action$NAME$(){ }" description="Creates Yii2 Action" toReformat="false" toShortenFQNames="true"> | |
<variable name="NAME" expression="capitalize(String)" defaultValue="View" alwaysStopAt="true" /> | |
<context> | |
<option name="PHP" value="true" /> | |
</context> | |
</template> | |
<template name="yt" value="Yii::t()" description="Yii::t()" toReformat="true" toShortenFQNames="true"> | |
<context> | |
<option name="PHP" value="true" /> | |
</context> | |
</template> | |
<template name="sfield" value="<?= $form->field($model, '$NAME$') ?>" description="<?= $form->field($model, 'name') ?>" toReformat="false" toShortenFQNames="true"> | |
<variable name="NAME" expression="camelCase(String)" defaultValue="$name" alwaysStopAt="true" /> | |
<context> | |
<option name="HTML" value="true" /> | |
</context> | |
</template> | |
<template name="btn_s" value=" <?= Html::submitButton('$VALUE$', ['class' => 'btn btn-primary']) ?>" description="<?= Html::submitButton('Submit', ['class' => 'btn btn-primary']) ?>" toReformat="false" toShortenFQNames="true"> | |
<variable name="VALUE" expression="capitalize(String)" defaultValue="Enviar" alwaysStopAt="false" /> | |
<context> | |
<option name="HTML" value="true" /> | |
</context> | |
</template> | |
<template name="getbyid" value="$variable$ = $CLASS$::find()->where(['id' => $id$])->one(); " description="$customer = Customer::find()->where(['id' => 1])->one();" toReformat="false" toShortenFQNames="true"> | |
<variable name="variable" expression="camelCase(String)" defaultValue="$instance" alwaysStopAt="true" /> | |
<variable name="CLASS" expression="classNameComplete()" defaultValue="$model" alwaysStopAt="true" /> | |
<variable name="id" expression="camelCase(String)" defaultValue="$id" alwaysStopAt="true" /> | |
<context> | |
<option name="PHP" value="true" /> | |
</context> | |
</template> | |
<template name="ch_field" value="<?= $form->field($model, '$ATTRIBUTE$')->checkbox(); ?>" description="<?= $form->field($model, 'population')->checkbox(); ?>" toReformat="false" toShortenFQNames="true"> | |
<variable name="ATTRIBUTE" expression="camelCase(String)" defaultValue="attribute" alwaysStopAt="true" /> | |
<context> | |
<option name="HTML" value="true" /> | |
</context> | |
</template> | |
</templateSet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment