本文整理汇总了PHP中ObjectCollection::normalizeObjectArray方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectCollection::normalizeObjectArray方法的具体用法?PHP ObjectCollection::normalizeObjectArray怎么用?PHP ObjectCollection::normalizeObjectArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectCollection
的用法示例。
在下文中一共展示了ObjectCollection::normalizeObjectArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: changeEditor
/**
* Changes the editor on the fly
*
* @param string $editor String name of editor, excluding the word 'Helper'
* @return void
* @author Jose Diaz-Gonzalez
**/
public function changeEditor($editor)
{
$this->helper = ucfirst($editor);
$prefix = '';
if ($editor !== 'Form') {
$prefix = 'Wysiwyg.';
}
if (!$this->importedHelpers[$this->helper]) {
$this->importedHelpers[$this->helper] = true;
$this->helpers[] = $prefix . $this->helper;
$this->_helperMap = ObjectCollection::normalizeObjectArray($this->helpers);
}
}
示例2: __construct
/**
* Default Constructor
*
* @param View $View The View this helper is being attached to.
* @param array $settings Configuration settings for the helper.
*/
public function __construct(View $View, $settings = array())
{
$this->_View = $View;
$this->request = $View->request;
if (!empty($this->helpers)) {
$this->_helperMap = ObjectCollection::normalizeObjectArray($this->helpers);
}
}
示例3: testnormalizeObjectArray
/**
* test normalizeObjectArray
*
* @return void
*/
public function testnormalizeObjectArray()
{
$components = array('Html', 'Foo.Bar' => array('one', 'two'), 'Something', 'Banana.Apple' => array('foo' => 'bar'));
$result = ObjectCollection::normalizeObjectArray($components);
$expected = array('Html' => array('class' => 'Html', 'settings' => array()), 'Bar' => array('class' => 'Foo.Bar', 'settings' => array('one', 'two')), 'Something' => array('class' => 'Something', 'settings' => array()), 'Apple' => array('class' => 'Banana.Apple', 'settings' => array('foo' => 'bar')));
$this->assertEquals($expected, $result);
// This is the result after Controller::_mergeVars
$components = array('Html' => null, 'Foo.Bar' => array('one', 'two'), 'Something' => null, 'Banana.Apple' => array('foo' => 'bar'));
$result = ObjectCollection::normalizeObjectArray($components);
$this->assertEquals($expected, $result);
}
示例4: changeEditor
/**
* Changes the editor on the fly
*
* @param string $editor String name of editor, excluding the word 'Helper'
* @param array $helperOptions Each type of wysiwyg helper takes different options.
* @return void
* @throws MissingHelperException
**/
public function changeEditor($editor, $helperOptions = array())
{
$this->helper = ucfirst($editor);
if (!empty($helperOptions)) {
$this->updateSettings($helperOptions);
}
if (!isset($this->importedHelpers[$this->helper])) {
throw new MissingHelperException(sprintf("Missing Wysiwyg.%s Helper", $this->helper));
}
if (!$this->importedHelpers[$this->helper]) {
$class = 'Wysiwyg.' . $this->helper;
$helpers = ObjectCollection::normalizeObjectArray(array($class));
foreach ($helpers as $properties) {
list($plugin, $class) = pluginSplit($properties['class']);
$this->{$class} = $this->_View->Helpers->load($properties['class'], $properties['settings']);
}
$this->importedHelpers[$this->helper] = true;
}
}