create() public static method

Returns new builder instance.
public static create ( ) : Sulu\Component\SmartContent\Configuration\BuilderInterface
return Sulu\Component\SmartContent\Configuration\BuilderInterface
Beispiel #1
0
 /**
  * Creates a new configuration object.
  *
  * @return BuilderInterface
  */
 protected static function createConfigurationBuilder()
 {
     return Builder::create();
 }
Beispiel #2
0
 /**
  * Initiate configuration.
  *
  * @return ProviderConfigurationInterface
  */
 private function initConfiguration()
 {
     $this->configuration = Builder::create()->enableTags()->enableCategories()->enableLimit()->enablePagination()->enablePresentAs()->enableDatasource('content-datasource@sulucontent', ['rootUrl' => '/admin/api/nodes?webspace={webspace}&language={locale}&fields=title,order,published&webspace-nodes=single', 'selectedUrl' => '/admin/api/nodes/{datasource}?tree=true&webspace={webspace}&language={locale}&fields=title,order,published&webspace-nodes=single', 'resultKey' => 'nodes'])->enableSorting([['column' => 'title', 'title' => 'smart-content.title'], ['column' => 'published', 'title' => 'smart-content.published'], ['column' => 'created', 'title' => 'smart-content.created'], ['column' => 'changed', 'title' => 'smart-content.changed']])->setDeepLink('content/contents/{webspace}/{locale}/edit:{id}/details')->getConfiguration();
     return $this->configuration;
 }
Beispiel #3
0
 public function testDatasourceWithoutOptions()
 {
     $component = 'test@sulutest';
     $builder = Builder::create();
     $this->assertEquals($builder, $builder->enableDatasource($component));
     $configuration = $builder->getConfiguration();
     $this->assertTrue($configuration->hasDatasource());
     $this->assertFalse($configuration->hasSorting());
     $this->assertFalse($configuration->hasTags());
     $this->assertFalse($configuration->hasCategories());
     $this->assertFalse($configuration->hasLimit());
     $this->assertFalse($configuration->hasPresentAs());
     $this->assertFalse($configuration->hasPagination());
     $componentConfiguration = $configuration->getDatasource();
     $this->assertEquals($component, $componentConfiguration->getName());
     $this->assertEquals([], $componentConfiguration->getOptions());
 }