listTemplates() public method

Lists templates, optionally filtered by $filter.
public listTemplates ( string $filter = null, boolean $safe = false ) : array
$filter string
$safe boolean
return array Sorted and possibly filtered templates
Example #1
0
 public function testListTemplatesTemplateSelect()
 {
     $app = $this->getApp();
     $app['config']->set('theme/templateselect/templates', ['koala' => ['name' => 'koala.twig', 'filename' => 'koala.twig'], 'clippy' => ['name' => 'clippy.twig', 'filename' => 'clippy.twig']]);
     $handler = new RecordHandler($app);
     $result = $handler->listTemplates('*.twig', false);
     $this->assertArrayHasKey('koala.twig', $result);
     $this->assertArrayHasKey('clippy.twig', $result);
     $this->assertArrayNotHasKey('entry.twig', $result);
     $this->assertArrayNotHasKey('extrafields.twig', $result);
     $this->assertArrayNotHasKey('index.twig', $result);
     $this->assertArrayNotHasKey('listing.twig', $result);
     $this->assertArrayNotHasKey('record.twig', $result);
 }