Elgg\Includer::includeFile PHP Method

includeFile() public static method

Include a file with as little context as possible
public static includeFile ( string $file ) : mixed
$file string File to include
return mixed
    public static function includeFile($file)
    {
        return include $file;
    }

Usage Example

Example #1
0
 /**
  * Registers the plugin's views
  *
  * @throws PluginException
  * @return void
  */
 protected function registerViews()
 {
     $views = _elgg_services()->views;
     // Declared views first
     $file = "{$this->path}/views.php";
     if (is_file($file)) {
         $spec = Includer::includeFile($file);
         if (is_array($spec)) {
             $views->mergeViewsSpec($spec);
         }
     }
     $spec = $this->getStaticConfig('views');
     if ($spec) {
         $views->mergeViewsSpec($spec);
     }
     // Allow /views directory files to override
     if (!$views->registerPluginViews($this->path, $failed_dir)) {
         $key = 'ElggPlugin:Exception:CannotRegisterViews';
         $args = [$this->getID(), $this->guid, $failed_dir];
         $msg = _elgg_services()->translator->translate($key, $args);
         throw new \PluginException($msg);
     }
 }
All Usage Examples Of Elgg\Includer::includeFile