Elgg\ViewsService::listViews PHP Method

listViews() public method

List all views in a viewtype
public listViews ( string $viewtype = 'default' ) : string[]
$viewtype string Viewtype
return string[]
    public function listViews($viewtype = 'default')
    {
        if (empty($this->locations[$viewtype])) {
            return [];
        }
        return array_keys($this->locations[$viewtype]);
    }

Usage Example

Example #1
0
 public function testCanListViews()
 {
     $views = $this->views->listViews('default');
     $this->assertTrue(in_array('interpreted.js', $views));
     $this->assertTrue(in_array('static.js', $views));
     $this->assertEmpty($this->views->listViews('fake_viewtype'));
 }