Skip to main content
replaced http://joomla.stackexchange.com/ with https://joomla.stackexchange.com/
Source Link

Through following this guide, I've created a plugin and installed it but I am having trouble with the final step. Most guides are saying to create a template override and if I create an override for com_content/article, default.php looks like it was meant purely for user view override. This other questionquestion here has an answer suggesting the rendering be done in edit.php, which, highly suggests it's only for editing articles. Is edit.php truly the corect place? If so, will rendering it that way bypass the conditionals I have in my onContentPrepareForm method?

Here is my onContentPrepareForm method, just in case:

function onContentPrepareForm($form,$data)
{
    $app = JFactory::getApplication();
    if(!($form instanceof JForm))
    {
        $this->_subject->setError('JERROR_NOT_A_FORM');
        return false;
    }
    
    if($form->getName() == 'com_content.article')
    {
        if ($app->isAdmin())
        {
            JForm::addFormPath(__DIR__ . '/forms');
            $form->loadFile('content', false);
        }
    }
}

Through following this guide, I've created a plugin and installed it but I am having trouble with the final step. Most guides are saying to create a template override and if I create an override for com_content/article, default.php looks like it was meant purely for user view override. This other question here has an answer suggesting the rendering be done in edit.php, which, highly suggests it's only for editing articles. Is edit.php truly the corect place? If so, will rendering it that way bypass the conditionals I have in my onContentPrepareForm method?

Here is my onContentPrepareForm method, just in case:

function onContentPrepareForm($form,$data)
{
    $app = JFactory::getApplication();
    if(!($form instanceof JForm))
    {
        $this->_subject->setError('JERROR_NOT_A_FORM');
        return false;
    }
    
    if($form->getName() == 'com_content.article')
    {
        if ($app->isAdmin())
        {
            JForm::addFormPath(__DIR__ . '/forms');
            $form->loadFile('content', false);
        }
    }
}

Through following this guide, I've created a plugin and installed it but I am having trouble with the final step. Most guides are saying to create a template override and if I create an override for com_content/article, default.php looks like it was meant purely for user view override. This other question here has an answer suggesting the rendering be done in edit.php, which, highly suggests it's only for editing articles. Is edit.php truly the corect place? If so, will rendering it that way bypass the conditionals I have in my onContentPrepareForm method?

Here is my onContentPrepareForm method, just in case:

function onContentPrepareForm($form,$data)
{
    $app = JFactory::getApplication();
    if(!($form instanceof JForm))
    {
        $this->_subject->setError('JERROR_NOT_A_FORM');
        return false;
    }
    
    if($form->getName() == 'com_content.article')
    {
        if ($app->isAdmin())
        {
            JForm::addFormPath(__DIR__ . '/forms');
            $form->loadFile('content', false);
        }
    }
}
Source Link
Chase
  • 137
  • 6

What is the proper file for a custom field in admin-only article creation?

Through following this guide, I've created a plugin and installed it but I am having trouble with the final step. Most guides are saying to create a template override and if I create an override for com_content/article, default.php looks like it was meant purely for user view override. This other question here has an answer suggesting the rendering be done in edit.php, which, highly suggests it's only for editing articles. Is edit.php truly the corect place? If so, will rendering it that way bypass the conditionals I have in my onContentPrepareForm method?

Here is my onContentPrepareForm method, just in case:

function onContentPrepareForm($form,$data)
{
    $app = JFactory::getApplication();
    if(!($form instanceof JForm))
    {
        $this->_subject->setError('JERROR_NOT_A_FORM');
        return false;
    }
    
    if($form->getName() == 'com_content.article')
    {
        if ($app->isAdmin())
        {
            JForm::addFormPath(__DIR__ . '/forms');
            $form->loadFile('content', false);
        }
    }
}