本文整理匯總了PHP中Nette\Object::extensionMethod方法的典型用法代碼示例。如果您正苦於以下問題:PHP Object::extensionMethod方法的具體用法?PHP Object::extensionMethod怎麽用?PHP Object::extensionMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Nette\Object
的用法示例。
在下文中一共展示了Object::extensionMethod方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: register
/**
* 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;
});
}
示例2: register
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);
});
}
示例3: register
/**
* 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;
});
}
示例4: register
/**
* @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;
});
}