Get row value in Custom Template

In custom template, how to get field value and use in
php code?

Example

<?php if ({{value stat}}=='pending') { $color='bg-success'; } ?>

$Name = $this->Name->CurrentValue;

OR

{{{value Name}}}

Do not use $this in Custom Template section. Use CurrentPage() instead.