Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorvektor

    First of all I'm new to Akelos, and I have a question about the sortable_link. API says the first argument is the column name. How can I write to the screen a friendly name not the real column name? for example 'Company name' and the column name is 'name' in the database.I hope it is possible.Thanks for the answer.


    PS: sorry for my english

    Hi Vektor, and welcome to the Akelos forum!

    Column names are provided by AkActiveRecord::getColumnNames() so you can override it in your controller like this:

    function getColumnNames()
        $column_names = parent::getColumnNames();
        $column_names['name'] = $this->t('Company name');
        return $column_names;

    In case you don't want column name translations, you can just define the attribute _columnNames in your model with a column => description array



    • CommentAuthorvektor
    Hi Bermi,

    thanks a lot, it is easier than i think before.

    • CommentAuthorvektor
    Hi again,

    I put your code to the model, but nothing is changed. You wrote I can override it in the controller, but there is no AkActiveRecord object available right? I forgot to wrote I'm new to oop too

    what was I missed?

    Ok, the sortable link generated by the scaffold uses the keys returned by getContentColumns(), try to use this instead in your views

     $content_columns = $Post->getColumnNames();
      CommentAuthorjulio montoya

    In share model .php we can add this function in order that all models could use it

    function getContentColumnsVariable($list)
            if (in_array($list[$i],$contact_column))
        return $list;

    And the in the template file we can add this

    $content_columns = $Contact->getContentColumnsVariable($list);

    {loop contacts} {loop content_columns} get($content_column) ?> {end} link_to_show($contact)?> link_to_edit($contact)?> link_to_destroy($contact)?>

    • CommentAuthorKaste

    isn't this simply


    [or another of those hundreds of array_*-functions]

    • CommentAuthorpogeybait4883
    I think what you're asking for is something like this:

    <%= sortable_link 'login', {}, :link_text => _('User') %>

    Where the database field is 'login' but you want to show the word 'User'.