Ejemplo n.º 1
0
<?php

//-->
use Eden\Handlebars\Data;
use Eden\Handlebars\Runtime;
return function ($data = array()) {
    $noop = function () {
    };
    Runtime::optimize();
    $context = $data = Data::i($data);
    $helper = Runtime::getHelpers($data);
    $buffer = '';
    $buffer .= '<div class="product-fields">' . "\n";
    $buffer .= '	<div class="form-group';
    $buffer .= $helper['if']($data->find('errors.product_title'), array('name' => 'if', 'args' => 'if errors.product_title', 'hash' => array(), 'fn' => function ($context = null) use($noop, $data, &$helper) {
        if (is_array($context)) {
            $data->push($context);
        }
        $buffer = '';
        $buffer .= ' has-error';
        if (is_array($context)) {
            $data->pop();
        }
        return $buffer;
    }, 'inverse' => $noop));
    $buffer .= ' clearfix">' . "\n";
    $buffer .= '        <label class="control-label">';
    $buffer .= htmlspecialchars($data->find('_ \'Title\''), ENT_COMPAT, 'UTF-8');
    $buffer .= '</label>' . "\n";
    $buffer .= '        <div>' . "\n";
    $buffer .= '            <input' . "\n";
Ejemplo n.º 2
0
 //or $data->find('something')
 $original = $name = array_shift($args);
 //we need the options
 $options = array_pop($args);
 //if it's a data lookup
 if (strpos($name, '$data->find(') === 0) {
     //this is not what we really want
     $name = substr($name, 12, -1);
 }
 //if it has quotes
 if (substr($name, 0, 1) === "'" && substr($name, -1) === "'") {
     //remove it
     $name = substr($name, 1, -1);
 }
 //get the partial
 $partial = \Eden\Handlebars\Runtime::getPartial($name);
 //but if the partial is null
 if (is_null($partial)) {
     //name is really the partial
     $partial = $name;
 }
 //if there are still arguments
 $scope = '';
 if (count($args)) {
     $scope = '\\r\\t\\1' . $args[0] . ', ';
 }
 //form hash
 $hash = array();
 foreach ($options['hash'] as $key => $value) {
     $hash[$key] = sprintf('\'%s\' => %s', $key, $value);
 }