fix calendar css, take 2. (#213)
[openemr.git] / interface / modules / zend_modules / library / Zend / View / Helper / Placeholder.php
blobcc7c2795e184cae098936fb1e328e42f00536228
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\View\Helper;
12 use Zend\View\Exception\InvalidArgumentException;
13 use Zend\View\Helper\Placeholder\Container;
15 /**
16 * Helper for passing data between otherwise segregated Views. It's called
17 * Placeholder to make its typical usage obvious, but can be used just as easily
18 * for non-Placeholder things. That said, the support for this is only
19 * guaranteed to effect subsequently rendered templates, and of course Layouts.
21 class Placeholder extends AbstractHelper
23 /**
24 * Placeholder items
26 * @var array
28 protected $items = array();
30 /**
31 * Default container class
32 * @var string
34 protected $containerClass = 'Zend\View\Helper\Placeholder\Container';
36 /**
37 * Placeholder helper
39 * @param string $name
40 * @throws InvalidArgumentException
41 * @return Placeholder\Container\AbstractContainer
43 public function __invoke($name = null)
45 if ($name === null) {
46 throw new InvalidArgumentException(
47 'Placeholder: missing argument. $name is required by placeholder($name)'
51 $name = (string) $name;
52 return $this->getContainer($name);
55 /**
56 * createContainer
58 * @param string $key
59 * @param array $value
60 * @return Container\AbstractContainer
62 public function createContainer($key, array $value = array())
64 $key = (string) $key;
66 $this->items[$key] = new $this->containerClass($value);
67 return $this->items[$key];
70 /**
71 * Retrieve a placeholder container
73 * @param string $key
74 * @return Container\AbstractContainer
76 public function getContainer($key)
78 $key = (string) $key;
79 if (isset($this->items[$key])) {
80 return $this->items[$key];
83 $container = $this->createContainer($key);
85 return $container;
88 /**
89 * Does a particular container exist?
91 * @param string $key
92 * @return bool
94 public function containerExists($key)
96 $key = (string) $key;
97 $return = array_key_exists($key, $this->items);
98 return $return;