mervick / yii2-mthaml

The MtHaml integration for the Yii2 framework.
MIT License
7 stars 1 forks source link

| Line continuations and GridView widget helpers #6

Open starrychloe opened 9 years ago

starrychloe commented 9 years ago

Surely there is a solution for this? I don't know what it is though.

  -echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => ['id', 'headline', 'desc1', 'desc2', 'display_url', 'landing_url', 'status', | 
    [                                     |
      'class' => 'yii\grid\ActionColumn', |
      'template' => '{pauseActive}',      |
      'buttons' => [                      |
        'pauseActive' => function ($url, $model, $key) {                                                  |
          return $model->status == Constants::ACTIVE ? Html::a('Pause', $url) : Html::a('UnPause', $url); |
        }                                                                                                 |
      ]                                   |
    ],                                    |
  ]])                                     |

Without them, it gives errors like

MtHaml\Exception\SyntaxErrorException The line was indented more than one level deeper than the previous line in

starrychloe commented 8 years ago

In case it wasn't clear, HAML allows multi-line code if it ends with ,: http://haml.info/docs/yardoc/file.REFERENCE.html#runningruby

mervick commented 8 years ago

But in your case it also contains [, ], {, }, ; at the end of lines.

If you want to offer this features go to MtHaml, this project is just integrate MtHaml in Yii