- md5
- df85872aa2de728987fb11c91b2135a6
- sha1
- b934a5fa2e2fab029710ea8bda911aa4cd746ab3
- sha256
- 81d41214cdb0e278b0e7a59711ad6c069d53bc3c58380808c3d87eefea04644d
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
<?php
/**
* @package Joomla.Administrator
* @subpackage com_media
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Media\Administrator\Model;
\defined('_JEXEC') or die;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\MVC\Model\FormModel;
use Joomla\CMS\Plugin\PluginHelper;
/**
* File Model
*
* @since 4.0.0
*/
class FileModel extends FormModel
{
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return \Joomla\CMS\Form\Form|boolean A Form object on success, false on failure
*
* @since 4.0.0
*/
public function getForm($data = [], $loadData = true)
{
PluginHelper::importPlugin('media-action');
// Load backend forms in frontend.
FormHelper::addFormPath(JPATH_ADMINISTRATOR . '/components/com_media/forms');
// Get the form.
$form = $this->loadForm('com_media.file', 'file', ['control' => 'jform', 'load_data' => $loadData]);
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the file information for the given path. Path must be
* in the format: adapter:path/to/file.extension
*
* @param string $path The path to get the information from.
*
* @return \stdClass An object with file information
*
* @since 4.0.0
* @see ApiModel::getFile()
*/
public function getFileInformation($path)
{
list($adapter, $path) = explode(':', $path, 2);
return $this->bootComponent('com_media')->getMVCFactory()->createModel('Api', 'Administrator')
->getFile($adapter, $path, ['url' => true, 'content' => true]);
}
}
The same content is in 2 releases, Joomla 4.0.0-beta4 to 4.0.0-beta5. See them all, or every version of this file.