/** * Register TextInputCustomLabel * @param string $control_name string * @return void */ public static function register($control_name = 'addTextCustomLabel') { Nette\Object::extensionMethod('Nette\\Forms\\Container::' . $control_name, function ($form, $name, $label = NULL, array $items = NULL) { $control = new self($label, $items); return $form[$name] = $control; }); }
public static function register($controlName = 'addMultiSelectFileChoicer') { if (!is_string($controlName)) { throw new Exception(sprintf('Control name must be string, %s given', gettype($controlName))); } Nette\Object::extensionMethod('Nette\\Forms\\Container::' . $controlName, function ($form, $name, IManager $mediaManager, $namespace, $label = null, $withPrimary = true) { return $form[$name] = new \vojtabiberle\MediaStorage\Bridges\Nette\Forms\Controls\MultiSelectFileChoicer($mediaManager, $namespace, $label, $withPrimary); }); }
/** * Register NotTranslatableSelectBox * @param string $control_name string * @return void */ public static function register($control_name = 'addNotTranslatableSelect') { Nette\Object::extensionMethod('Nette\\Forms\\Container::' . $control_name, function ($form, $name, $label = NULL, array $items = NULL, $size = NULL) { $control = new self($label, $items); if ($size > 1) { $control->setAttribute('size', (int) $size); } return $form[$name] = $control; }); }
/** * @param string $controlName * @throws ImageStorageException */ public static function register($controlName = 'addMultiImageUpload') { if (!is_string($controlName)) { throw new ImageStorageException(sprintf('Control name must be a string, %s given', gettype($controlName))); } Object::extensionMethod(Container::class . '::' . $controlName, function ($form, $name, $label = NULL, $namespace = NULL) { $control = new self($label); $control->setNamespace($namespace); return $form[$name] = $control; }); }