Wire::addHookProperty PHP Метод

addHookProperty() публичный Метод

i.e. $obj->property; in addition to $obj->property(); This is the same as calling addHook with the 'type' option set to 'property' in the $options array. Note that descending classes that override __get must call getHook($property) and/or runHook($property). If you are hooking a procedural function, you may omit the $toObject and instead just call via: $this->addHookProperty($method, 'function_name');
public addHookProperty ( string $property, object | null | callable $toObject, string $toMethod = null, array $options = [] ) : string
$property string Method name to hook into, NOT including the three preceding underscores May also be Class::Method for same result as using the fromClass option.
$toObject object | null | callable Object to call $toMethod from, Or null if $toMethod is a function outside of an object, Or function|callable if $toObject is not applicable or function is provided as a closure.
$toMethod string Method from $toObject, or function name to call on a hook event. Optional.
$options array See self::$defaultHookOptions at the beginning of this class. Optional.
Результат string A special Hook ID that should be retained if you need to remove the hook later
    public function addHookProperty($property, $toObject, $toMethod = null, $options = array())
    {
        $options['type'] = 'property';
        return $this->addHook($property, $toObject, $toMethod, $options);
    }