コード例 #1
-1
ファイル: RecordLink.php プロジェクト: skema/skema
 public function renderHTMLInput()
 {
     $template = $this->field->htmlInputTemplate;
     $options = '';
     $this->field->eachOption(function ($directives, $recordID) use(&$options, $template) {
         $optionText = Utility::mustachify($template, function ($match) use($directives, $recordID) {
             if (isset($directives[$match])) {
                 return Type::Directive($directives[$match])->renderPlain();
             } else {
                 if ($match === 'key') {
                     return $recordID;
                 }
             }
             return '';
         });
         $optionTextEncoded = htmlentities($optionText);
         $selected = $this->value == $recordID ? ' selected="selected"' : '';
         $options .= "<option value='{$recordID}'{$selected}>{$optionTextEncoded}</option>";
     });
     $key = $this->key();
     return "<select name='{$key}'>{$options}</select>";
 }