akeeba / fof

Rapid Application Development framework for Joomla!™ 3 and 4
0 stars 0 forks source link

Migrat 3.4 - 3.6 #691

Closed Mika17420 closed 3 years ago

Mika17420 commented 3 years ago

I am using the getRenderForm function in my component with fof 3.4. Since update 3.6, Akeebastrapper.php in the render folder has disappeared and all my renderings no longer work. What's the quick fix to fix the problem? thank you very much

nikosdion commented 3 years ago

There's no quick fix. You need to create regular PHP or Blade templates to replace your forms. You will also need to change your View classes to extend one of the DataView superclasses, typically Html.

This change was far from being a surprise. The Forms package was deprecated since FOF 3.1.4 released on November 24th, 2017. I had added a note that you need to migrate all your views to PHP or Blade templates. At this point I had stopped maintaining the Forms and Scaffolding packages.

I had to finally remove the Forms and Scaffolding code completely in FOF 3.6.0 released on June 12th, 2020. At this point I had to add full support for Joomla 4 to all of my software and Forms could not be migrated. Choosing between not supporting Joomla 4 at all or removing the code I had deprecated two and a half years ago I chose the latter.

Remember that notices for feature removals typically come at 6 to 12 months prior to the change. I gave you 32 months.

Moreover, you have to go through FAR LESS pain than we did during our extensions' migration, as long as you use Blade. We have included common Blade templates for Browse views, Edit views and even showing and selecting users (which is a pain in the rear, trust me on that). Each file tells you how to use it.

Here's a quick and dirty example for a Browse view, let's call it default.blade.php:

@extends('any:lib_fof30/Common/browse')

@section('browse-filters')
    <div class="akeeba-filter-element akeeba-form-group">
        @searchfilter('title', 'title', 'COM_EXAMPLE_COMMON_TITLE')
    </div>

    <div class="akeeba-filter-element akeeba-form-group">
        {{ \FOF30\Utils\FEFHelper\BrowseView::publishedFilter('enabled', 'JENABLED') }}
    </div>
@stop

@section('browse-table-header')
    <tr>
        <td width="8%">
            @sortgrid('ordering', '<i class="icon-menu-2"></i>')
        </td>
        <th width="20px">
            @jhtml('FEFHelper.browse.checkall')
        </th>
        <th>
            @sortgrid('title', 'COM_EXAMPLE_COMMON_TITLE')
        </th>
        <th width="8%">
            @sortgrid('enabled', 'JENABLED')
        </th>
    </tr>
@stop

@section('browse-table-body-withrecords')
<?php
    /** @var \Acme\Example\Admin\Model\Items $row */
    $i = 0;
    $enabled = $this->container->platform->getUser()->authorise('core.edit.state', 'com_ats');
    ?>
    @foreach($this->items as $row):
        <tr>
            <td>
                @jhtml('FEFHelper.browse.order', 'ordering', $row->ordering)
            </td>
            <td>
                @jhtml('FEFHelper.browse.id', ++$i, $row->getId())
            </td>
            <td>
                <a href="@route(\FOF30\Utils\FEFHelper\BrowseView::parseFieldTags('index.php?option=com_example&view=Items&task=edit&id=[ITEM:ID]', $row))">
                    {{{ $row->title }}}
                </a>
            </td>
            <td>
                @jhtml('FEFHelper.browse.published', $row->enabled, $i, '', $enabled)
            </td>
        </tr>
    @endforeach
@stop

Look at the Utils\FEFHelper package to see some utility classes we created for our own CSS framework, FEF. You can of course create your own helpers for Bootstrap 2 or whatever CSS framework you are using in your extensions. You can extend Blade with your custom code too. Everything I just mentioned is used in Akeeba Ticket System Core. You are welcome to examine its code and see how we're doing things.

Mika17420 commented 3 years ago

Thank you Nicholas for all these explanations. It's a very big job for me. Have you received my email ?

nikosdion commented 3 years ago

No, I have not received any email.