Craft\RetourFieldType::getInputHtml PHP Method

getInputHtml() public method

Returns the field's input HTML.
public getInputHtml ( string $name, mixed $value ) : string
$name string
$value mixed
return string
    public function getInputHtml($name, $value)
    {
        $id = craft()->templates->formatInputId($name);
        $namespacedId = craft()->templates->namespaceInputId($id);
        // Include our Javascript & CSS
        craft()->templates->includeCssResource('retour/css/fields/RetourFieldType.css');
        craft()->templates->includeJsResource('retour/js/fields/RetourFieldType.js');
        /* -- Variables to pass down to our field.js */
        $jsonVars = array('id' => $id, 'name' => $name, 'namespace' => $namespacedId, 'prefix' => craft()->templates->namespaceInputId(""));
        $jsonVars = json_encode($jsonVars);
        craft()->templates->includeJs("\$('#{$namespacedId}').RetourFieldType(" . $jsonVars . ");");
        /* -- Get the list of matches */
        $matchList = craft()->retour->getMatchesList();
        /* -- Variables to pass down to our rendered template */
        $variables = array('id' => $id, 'name' => $name, 'namespaceId' => $namespacedId, 'matchList' => $matchList, 'element' => $this->element, 'field' => $this->model, 'values' => $value);
        return craft()->templates->render('retour/fields/RetourFieldType.twig', $variables);
    }