public function SessionHelper::clearPath in Examples for Developers 3.x
Same name and namespace in other branches
- 8 stream_wrapper_example/src/SessionHelper.php \Drupal\stream_wrapper_example\SessionHelper::clearPath()
Clear a path into our store.
Parameters
string $path: The path portion of a URI (i.e., without the SCHEME://).
File
- modules/
stream_wrapper_example/ src/ SessionHelper.php, line 145
Class
- SessionHelper
- Helper to manage file wrapper data stored in the session object.
Namespace
Drupal\stream_wrapper_exampleCode
public function clearPath($path) {
$this
->getStore();
if ($this
->checkPath($path)) {
$path_info = $this
->getParentPath($path);
$store_info = $this
->processPath($path_info['dirname']);
if ($store_info === FALSE) {
// The path was not found, nothing to do.
return;
}
// We want to clear the key at the tip, so...
unset($store_info['tip'][$path_info['basename']]);
// Write back to the store.
$this
->setStore($store_info['store']);
}
}