本文整理汇总了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;
});
}