本文整理汇总了PHP中Illuminate\View\View::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP View::getName方法的具体用法?PHP View::getName怎么用?PHP View::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\View\View
的用法示例。
在下文中一共展示了View::getName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addView
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
$path = $view->getPath();
if (!is_object($path)) {
if ($path) {
$path = ltrim(str_replace(base_path(), '', realpath($path)), '/');
}
if (substr($path, -10) == '.blade.php') {
$type = 'blade';
} else {
$type = pathinfo($path, PATHINFO_EXTENSION);
}
} else {
$type = get_class($view);
$path = '';
}
if (!$this->collect_data) {
$params = array_keys($view->getData());
} else {
$data = array();
foreach ($view->getData() as $key => $value) {
$data[$key] = $this->exporter->exportValue($value);
}
$params = $data;
}
$this->templates[] = array('name' => $path ? sprintf('%s (%s)', $name, $path) : $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
}
示例2: addView
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
$path = $view->getPath();
if ($path) {
$path = ltrim(str_replace(base_path(), '', realpath($path)), '/');
}
if (substr($path, -10) == '.blade.php') {
$type = 'blade';
} else {
$type = pathinfo($path, PATHINFO_EXTENSION);
}
if (!$this->collect_data) {
$params = array_keys($view->getData());
} else {
$data = array();
foreach ($view->getData() as $key => $value) {
if (in_array($key, ['__env', 'app', 'errors', 'obLevel', 'currentUser'])) {
continue;
}
$data[$key] = $this->exportValue($value);
}
$params = $data;
}
$this->templates[] = array('name' => $path ? sprintf('%s (%s)', $name, $path) : $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
}
示例3: addView
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
if (!$this->collect_data) {
$this->views[] = $name;
} else {
$data = array();
foreach ($view->getData() as $key => $value) {
if (is_object($value) and method_exists($value, 'toArray')) {
$data[$key] = $value->toArray();
} else {
$data[$key] = $value;
}
}
$this->views[] = $name . ' => ' . $this->formatVar($data);
}
}
示例4: addView
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
$type = pathinfo($view->getPath(), PATHINFO_EXTENSION);
if (!$this->collect_data) {
$params = array_keys($view->getData());
} else {
$data = array();
foreach ($view->getData() as $key => $value) {
if (is_object($value) && method_exists($value, 'toArray')) {
$value = $value->toArray();
}
$data[$key] = $this->exporter->exportValue($value);
}
$params = $data;
}
$this->templates[] = array('name' => $name, 'param_count' => count($params), 'params' => $params, 'type' => $type);
}
示例5: addView
/**
* Add a View instance to the Collector
*
* @param \Illuminate\View\View $view
*/
public function addView(View $view)
{
$name = $view->getName();
if (!$this->collect_data) {
$this->data[$name] = $name;
} else {
$data = array();
foreach ($view->getData() as $key => $value) {
if (is_object($value)) {
if (method_exists($value, 'toArray')) {
$data[$key] = $value->toArray();
} else {
$data[$key] = "Object (" . get_class($value) . ")";
}
} else {
$data[$key] = $value;
}
}
$this->data[$name] = $data;
}
}
示例6: callCreator
/**
* Call the creator for a given view.
*
* @param \Illuminate\View\View $view
* @return void
*/
public function callCreator(View $view)
{
$this->events->fire('creating: ' . $view->getName(), [$view]);
}
示例7: getOverloadPath
/**
* Get the override view path.
*
* @param $view
* @return null|string
*/
public function getOverloadPath(View $view)
{
/**
* We can only overload namespaced
* views right now.
*/
if (!str_contains($view->getName(), '::')) {
return null;
}
/**
* Split the view into it's
* namespace and path.
*/
list($namespace, $path) = explode('::', $view->getName());
$path = str_replace('.', '/', $path);
/**
* If the module is shorthand
* then check to see if we have
* an active module to use for it.
*/
if ($namespace === 'module' && $this->module) {
$namespace = $this->module->getNamespace();
}
/**
* If the view is already in
* the theme then skip it.
*/
if ($namespace == 'theme' || str_is('*.theme.*', $namespace)) {
return null;
}
/**
* If the view is a streams view then
* it's real easy to guess what the
* override path should be.
*/
if ($namespace == 'streams') {
$path = $this->theme->getNamespace('streams/' . $path);
}
/**
* If the view uses a dot syntax namespace then
* transform it all into the override view path.
*/
if ($addon = $this->addons->get($namespace)) {
$path = $this->theme->getNamespace("addons/{$addon->getVendor()}/{$addon->getSlug()}-{$addon->getType()}/" . $path);
}
if ($this->view->exists($path)) {
return $path;
}
/**
* If the view uses a dot syntax namespace then
* transform it all into the override view path.
*
* @deprecated since v3.0.0
*/
if ($addon) {
$path = $this->theme->getNamespace("addon/{$addon->getVendor()}/{$addon->getSlug()}-{$addon->getType()}/" . $path);
}
if ($this->view->exists($path)) {
return $path;
}
return null;
}
示例8: callComposer
/**
* Call the composer for a given view.
*
* @param Illuminate\View\View $view
* @return void
*/
public function callComposer(View $view)
{
$this->events->fire('composing: ' . $view->getName(), array($view));
}