PHP code example of geniv / nette-html-select

1. Go to this page and download the library: Download geniv/nette-html-select library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

geniv / nette-html-select example snippets


protected function createComponentHtmlSelect(HtmlSelect $htmlSelect): HtmlSelect
{
    $htmlSelect->setTemplatePath(__DIR__ . '/templates/htmlSelect.latte');

    // add all in one - strict internal check route for method: setRoute()
    $htmlSelect->setRoute('SwitchFkId!');
    $htmlSelect->setPrompt('-- žádný výběr --');
    $htmlSelect->clearItems();
    $htmlSelect->addItem('name', 'param');
    $htmlSelect->setItems([1 => 'a', 2 => 'b']);
    $htmlSelect->setItems([1 => 'a', 2 => 'b'], false);

    $htmlSelect->addVariableTemplate([1 => 'a']);
    
    $htmlSelect->setActiveValue('aaaxx');

    // add step by step - nothing internal check
    $htmlSelect->setParameter('order', 'asc');
    $htmlSelect->addLink('Abecedně A - Z', 'Sort!', ['order' => 'asc']);
    $htmlSelect->addLink('Abecedně Z - A', 'Sort!', ['order' => 'desc']);
    return $htmlSelect;
}
json
"php": ">=7.0",
"nette/application": ">=2.4",
"nette/utils": ">=2.4",
"geniv/nette-general-form": ">=1.0"