Overview

Namespaces

  • Charcoal
    • Admin
      • Widget
        • Cms
    • Cms
      • Config
      • Mixin
        • Traits
      • Route
      • Section
      • Service
        • Loader
        • Manager
      • ServiceProvider
      • Support
        • Helpers
        • Interfaces
        • Traits
    • Property

Classes

  • Charcoal\Admin\Widget\Cms\HierarchicalSectionTableWidget
  • Charcoal\Admin\Widget\Cms\SectionTableWidget
  • Charcoal\Cms\AbstractDocument
  • Charcoal\Cms\AbstractEvent
  • Charcoal\Cms\AbstractFaq
  • Charcoal\Cms\AbstractImage
  • Charcoal\Cms\AbstractNews
  • Charcoal\Cms\AbstractSection
  • Charcoal\Cms\AbstractText
  • Charcoal\Cms\AbstractVideo
  • Charcoal\Cms\Config
  • Charcoal\Cms\Config\CmsConfig
  • Charcoal\Cms\Config\EventConfig
  • Charcoal\Cms\Config\NewsConfig
  • Charcoal\Cms\Config\SectionConfig
  • Charcoal\Cms\Document
  • Charcoal\Cms\DocumentCategory
  • Charcoal\Cms\EmptySection
  • Charcoal\Cms\Event
  • Charcoal\Cms\EventCategory
  • Charcoal\Cms\ExternalSection
  • Charcoal\Cms\Faq
  • Charcoal\Cms\FaqCategory
  • Charcoal\Cms\Image
  • Charcoal\Cms\ImageCategory
  • Charcoal\Cms\News
  • Charcoal\Cms\NewsCategory
  • Charcoal\Cms\Route\EventRoute
  • Charcoal\Cms\Route\GenericRoute
  • Charcoal\Cms\Route\NewsRoute
  • Charcoal\Cms\Route\SectionRoute
  • Charcoal\Cms\Section
  • Charcoal\Cms\Section\BlocksSection
  • Charcoal\Cms\Section\ContentSection
  • Charcoal\Cms\Service\Loader\AbstractLoader
  • Charcoal\Cms\Service\Loader\EventLoader
  • Charcoal\Cms\Service\Loader\NewsLoader
  • Charcoal\Cms\Service\Loader\SectionLoader
  • Charcoal\Cms\Service\Manager\AbstractManager
  • Charcoal\Cms\Service\Manager\EventManager
  • Charcoal\Cms\Service\Manager\NewsManager
  • Charcoal\Cms\ServiceProvider\CmsServiceProvider
  • Charcoal\Cms\Support\Helpers\DateHelper
  • Charcoal\Cms\Tag
  • Charcoal\Cms\Text
  • Charcoal\Cms\TextCategory
  • Charcoal\Cms\Video
  • Charcoal\Cms\VideoCategory
  • Charcoal\Property\TemplateOptionsProperty
  • Charcoal\Property\TemplateProperty

Interfaces

  • Charcoal\Cms\DocumentInterface
  • Charcoal\Cms\EventInterface
  • Charcoal\Cms\FaqInterface
  • Charcoal\Cms\ImageInterface
  • Charcoal\Cms\MetatagInterface
  • Charcoal\Cms\Mixin\HasContentBlocksInterface
  • Charcoal\Cms\NewsInterface
  • Charcoal\Cms\SearchableInterface
  • Charcoal\Cms\SectionInterface
  • Charcoal\Cms\Support\Interfaces\EventManagerAwareInterface
  • Charcoal\Cms\Support\Interfaces\NewsManagerAwareInterface
  • Charcoal\Cms\Support\Interfaces\SectionLoaderAwareInterface
  • Charcoal\Cms\TemplateableInterface
  • Charcoal\Cms\TextInterface
  • Charcoal\Cms\VideoInterface

Traits

  • Charcoal\Admin\Widget\Cms\SectionTableTrait
  • Charcoal\Cms\MetatagTrait
  • Charcoal\Cms\Mixin\Traits\HasContentBlocksTrait
  • Charcoal\Cms\SearchableTrait
  • Charcoal\Cms\Support\Traits\DateHelperAwareTrait
  • Charcoal\Cms\Support\Traits\EventManagerAwareTrait
  • Charcoal\Cms\Support\Traits\NewsManagerAwareTrait
  • Charcoal\Cms\Support\Traits\SectionLoaderAwareTrait
  • Charcoal\Cms\TemplateableTrait
  • Overview
  • Namespace
  • Class
 1: <?php
 2: 
 3: namespace Charcoal\Property;
 4: 
 5: use PDO;
 6: 
 7: use RuntimeException;
 8: use InvalidArgumentException;
 9: 
10: // From Pimple
11: use Pimple\Container;
12: 
13: // From 'charcoal-property'
14: use Charcoal\Property\AbstractProperty;
15: use Charcoal\Property\SelectablePropertyInterface;
16: use Charcoal\Property\SelectablePropertyTrait;
17: 
18: /**
19:  * Template Selector Property
20:  */
21: class TemplateProperty extends AbstractProperty implements SelectablePropertyInterface
22: {
23:     use SelectablePropertyTrait;
24: 
25:     /**
26:      * Inject dependencies from a DI Container.
27:      *
28:      * @param  Container $container A dependencies container instance.
29:      * @return void
30:      */
31:     public function setDependencies(Container $container)
32:     {
33:         parent::setDependencies($container);
34: 
35:         $this->setChoices($container['config']['templates']);
36:     }
37: 
38:     /**
39:      * @return string
40:      */
41:     public function type()
42:     {
43:         return 'template';
44:     }
45: 
46:     /**
47:      * Retrieve the selected template's fully-qualified class name.
48:      *
49:      * @return string|null
50:      */
51:     public function __toString()
52:     {
53:         $val = $this->val();
54:         $tpl = $this->choice($val);
55: 
56:         if (isset($tpl['class'])) {
57:             return $tpl['class'];
58:         }
59: 
60:         return null;
61:     }
62: 
63:     /**
64:      * @return string
65:      */
66:     public function sqlExtra()
67:     {
68:         return '';
69:     }
70: 
71:     /**
72:      * Get the SQL type (Storage format)
73:      *
74:      * Stored as `VARCHAR` for maxLength under 255 and `TEXT` for other, longer strings
75:      *
76:      * @return string The SQL type
77:      */
78:     public function sqlType()
79:     {
80:         // Multiple strings are always stored as TEXT because they can hold multiple values
81:         if ($this->multiple()) {
82:             return 'TEXT';
83:         }
84: 
85:         return 'VARCHAR(255)';
86:     }
87: 
88:     /**
89:      * @return integer
90:      */
91:     public function sqlPdoType()
92:     {
93:         return PDO::PARAM_STR;
94:     }
95: }
96: 
API documentation generated by ApiGen