src/Forms/FontIconField.php
public function search(HTTPRequest $request)
    {
        // Detect Ajax:
        
        if (!$request->isAjax()) {
            return;
        }
        
        // Initialise:
        
        $data = [];
        
        // Filter Icons:
        
        if ($term = $request->getVar('term')) {
            
            // Create Groups Array:
            
            $groups = [];
            
            // Iterate Icon Groups:
            
            foreach ($this->backend->getGroupedIcons() as $group => $icons) {
                
                // Create Children Array:
                
                $children = [];
                
                // Iterate Icons in Group:
                
                foreach ($icons as $id => $icon) {
                    
                    if (stripos($id, $term) !== false) {
                        $children[] = $this->getResultData($this->getIconData($id));
                    }
                    
                }
                
                // Create Result Group (if children defined):
                
                if (!empty($children)) {
                    
                    $groups[] = [
                        'text' => $group,
                        'children' => $children
                    ];
                    
                }
                
            }
            
            // Define Results:
            
            $data['results'] = $groups;
            
        }
        
        // Answer JSON Response:
        
        return $this->respond($data);
    }
public function search(HTTPRequest $request)
    {
        // Detect Ajax:
        
        if (!$request->isAjax()) {
            return;
        }
        
        // Initialise:
        
        $data = [];
        
        // Filter Icons:
        
        if ($term = $request->getVar('term')) {
            
            // Create Groups Array:
            
            $groups = [];
            
            // Iterate Icon Groups:
            
            foreach ($this->backend->getGroupedIcons() as $group => $icons) {
                
                // Create Children Array:
                
                $children = [];
                
                // Iterate Icons in Group:
                
                foreach ($icons as $id => $icon) {
                    
                    if (stripos($id, $term) !== false) {
                        $children[] = $this->getResultData($this->getIconData($id));
                    }
                    
                }
                
                // Create Result Group (if children defined):
                
                if (!empty($children)) {
                    
                    $groups[] = [
                        'text' => $group,
                        'children' => $children
                    ];
                    
                }
                
            }
            
            // Define Results:
            
            $data['results'] = $groups;
            
        }
        
        // Answer JSON Response:
        
        return $this->respond($data);
    }
Answers an HTTP response containing JSON results matching the given search parameters.

@param HTTPRequest $request

@return HTTPResponse