Call plugin inside collector view

Si vous avez des questions sur le fonctionnement du composant

par oceanosoft » Jeu 23 Juin 2011 16:25

Hello steevo!

First of all, thanks for your amazing component. I love it!
Hope you keep up the good work.
Now to my question:
I've created a custom field in the collector fields.
Its a multi line text field and inside this field I want collector to load a plugin, with the code {plugin}code{/plugin}
In this case I want to add a youtube video using {youtube}videoid{/youtube}
On a normal article, the plugin works well, but in the collector field, it only shows the code.
The video won't load.
On another component I neded to edit the code:
/public_html/components/com_djcatalog2/views/items/tmpl/default.php
Code to change is in line 58

Code: Tout sélectionner
<?php echo $this->category->description; ?>


replace it with this code

Code: Tout sélectionner
<?php
$description = JHTML::_('content.prepare', $this->category->description);


But the collector view page is a lot different and I don't know how to edit it to get the plugin working.
Can you help me?
Thanks!
echo $description;
?>
oceanosoft
 
Messages: 2
Inscription: Jeu 23 Juin 2011 16:15

par oceanosoft » Jeu 23 Juin 2011 17:56

Well, got it solved by myself.
I will post the solution here just in case anybody else is interested in calling plugins inside collector.
Just check that the plugin is enabled and working.
Then open /components/com_collector/views/item/tmpl/default_default.php

Replace on line 15:
Code: Tout sélectionner
<?php echo $this->createFieldDescription($field); ?>



With:
Code: Tout sélectionner
<?php echo $output = JHTML::_('content.prepare', $this->createFieldDescription($field)); ?>


Save the file and you are done!
Now plugins called in a custom field get displayed.
oceanosoft
 
Messages: 2
Inscription: Jeu 23 Juin 2011 16:15

par steevo » Ven 24 Juin 2011 15:46

Hi!
Thank you for that. I thought that i had made it work but i think that it's only on my dev version.
I will implement that in next version.
Thank you again.
Avatar de l’utilisateur
steevo
Administrateur du site
 
Messages: 330
Inscription: Jeu 17 Déc 2009 22:59

par steevo » Dim 17 Juil 2011 19:45

I found what i did on my dev version:
in the file components\com_collector\views\item\view.html.php

replace
Code: Tout sélectionner
      /*
       * Process the prepare content plugins
       */
      JPluginHelper::importPlugin('collector');


by
Code: Tout sélectionner
      /*
       * Process the prepare content plugins
       */
      JPluginHelper::importPlugin('content');
      
      $dispatcher =& JDispatcher::getInstance();
        $article->params = clone($params);
      
      foreach ( $fields as $field )
      {
         if ($field->type == 2)
         {
            $field_name = 'field_'.$field->id;
            $article->text = & $item->$field_name;
            $dispatcher->trigger('onPrepareContent', array (& $article, & $article->params, 0));
         }
      }
Avatar de l’utilisateur
steevo
Administrateur du site
 
Messages: 330
Inscription: Jeu 17 Déc 2009 22:59


Retourner vers Questions diverses

cron

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 1 invité