src/controllers/DefaultController.php
protected function extractElementsFromComponent()
    {
        $elements = [];
        foreach (Yii::$app->element->getElements() as $name => $closure) {
            $reflection = new \ReflectionFunction($closure);
            $args = $reflection->getParameters();
            $params = [];
            $writtenParams = [];
            foreach ($args as $k => $v) {
                $mock = Yii::$app->element->getMockedArgValue($name, $v->name);
                if ($mock !== false) {
                    $params[] = $mock;
                    if (is_array($mock)) {
                        $writtenParams[] = 'array $'.$v->name;
                    } else {
                        $writtenParams[] = '$'.$v->name;
                    }
                } else {
                    if ($v->isArray()) {
                        $params[] = ['$'.$v->name];
                        $writtenParams[] = 'array $'.$v->name;
                    } else {
                        $params[] = '$'.$v->name;
                        $writtenParams[] = '$'.$v->name;
                    }
                }
            }
            
            $elements[] = $this->defineElement($name, $name, null, $params, [], $writtenParams);
        }
        
        return [
            'groups' => [
                [
                    'name' => 'Elements',
                    'description' => 'Basic element overview',
                    'elements' => $elements,
                ]
            ]
        ];
    }
protected function extractElementsFromComponent()
    {
        $elements = [];
        foreach (Yii::$app->element->getElements() as $name => $closure) {
            $reflection = new \ReflectionFunction($closure);
            $args = $reflection->getParameters();
            $params = [];
            $writtenParams = [];
            foreach ($args as $k => $v) {
                $mock = Yii::$app->element->getMockedArgValue($name, $v->name);
                if ($mock !== false) {
                    $params[] = $mock;
                    if (is_array($mock)) {
                        $writtenParams[] = 'array $'.$v->name;
                    } else {
                        $writtenParams[] = '$'.$v->name;
                    }
                } else {
                    if ($v->isArray()) {
                        $params[] = ['$'.$v->name];
                        $writtenParams[] = 'array $'.$v->name;
                    } else {
                        $params[] = '$'.$v->name;
                        $writtenParams[] = '$'.$v->name;
                    }
                }
            }
            
            $elements[] = $this->defineElement($name, $name, null, $params, [], $writtenParams);
        }
        
        return [
            'groups' => [
                [
                    'name' => 'Elements',
                    'description' => 'Basic element overview',
                    'elements' => $elements,
                ]
            ]
        ];
    }
protected function extractElementsFromComponent ( ) { $ elements = [ ] ; foreach ( Yii :: $ app -> element -> getElements ( ) as $ name => $ closure ) { $ reflection = new \ ReflectionFunction ( $ closure ) ; $ args = $ reflection -> getParameters ( ) ; $ params = [ ] ; $ writtenParams = [ ] ; foreach ( $ args as $ k => $ v ) { $ mock = Yii :: $ app -> element -> getMockedArgValue ( $ name , $ v -> name ) ; if ( $ mock !== false ) { $ params [ ] = $ mock ; if ( is_array ( $ mock ) ) { $ writtenParams [ ] = 'array $' . $ v -> name ; } else { $ writtenParams [ ] = '$' . $ v -> name ; } } else { if ( $ v -> isArray ( ) ) { $ params [ ] = [ '$' . $ v -> name ] ; $ writtenParams [ ] = 'array $' . $ v -> name ; } else { $ params [ ] = '$' . $ v -> name ; $ writtenParams [ ] = '$' . $ v -> name ; } } } $ elements [ ] = $ this -> defineElement ( $ name , $ name , null , $ params , [ ] , $ writtenParams ) ; } return [ 'groups' => [ [ 'name' => 'Elements' , 'description' => 'Basic element overview' , 'elements' => $ elements , ] ] ] ; }
Extract the data from the element component

@return array
Extract the data from the element component