Jump to content

nabo

Members
  • Posts

    110
  • Joined

  • Last visited

Posts posted by nabo

  1. Hello

    it would be nice if it could be possible to force a unique (or relative) imagefield for CKEditor.

    Example
    Using a repeater matrix (or repeater) with CKEditor field, the primary sources for images are imagefields in the page-repeater fieldset. Obviously I can change the page source, but I need to start from the root and this is not comfortable. In this specific situation the better solution is to have an imagefield in the parent page and force CKEditor to automatically go there... or if you want to have a "media library" go there first.

    Don't know which could be the best "setting system" but in my opinion this is an annoying problem.

  2. Hello

    I have a strange problem with $page->find
    The problem is that it's not work for a particular template. I correctly get the starting $page but these kind of selectors don't work 

    $page->find("template=my-template")
    $pages->find("has_parent=xxx,template=my-template")

    but these work

    $page->find("template=another-template")
    $pages->find("template=my-template")

    I tried also with include=all in the selector.

    The strage thing is that I repeat the same procedure with another starting parent $page the system works perfectly.

    Any ideas?

  3. Hi @kongondo

    thanks for your work, I really appreciate and have waited for a long time 🙂
    I'm really excited to test PadLoper2.

    I have some questions

    1) since PadLoper product are separated by PW pages, are you planning to do an Inputfield for select PL2 product? It could be useful if you want to use a richer product page modeling it with PW fields.

    2) PL users are different from PW users? 

    • Like 1
  4. Hello

     I'm trying to use export/import. The export works correctly, but when I try to import data I get this error for each row.

     1. Page: /en/data/coupons/coupon_code/ – Fail

     Unable to locate parent page: /en/data/coupons/
     Page cannot be imported

    I tried every options (changing parent, erasing path info from json)... but nothing.

    Any idea?

     
  5. I got a solution (maybe there are others better than mine)

    public function init() {
        if($this->wire('user')->isSuperuser()) {
          $this->wire()->addHookAfter('ProcessPageEdit::buildFormSettings', $this, 'buildForm');
          $this->wire()->addHookBefore('Pages::saveReady', $this, 'saveForm');
        }
      }
    
      public function buildForm(HookEvent $event) {
    
        $p = $event->object->getPage();
        $inputfields = $event->return;
    
    	$data = wire('modules')->getConfig($this);
    
        $fieldset = $this->wire('modules')->get("InputfieldFieldset");
        $fieldset->attr('id', 'my_fieldset');
        $fieldset->label = __("My Renders");
        $fieldset->collapsed = Inputfield::collapsedYes;
    
        $field = $this->wire('modules')->get("InputfieldTextarea"); 
        $field->attr('name', 'renders'); 
        $field->attr('value', $data['RendersPages'][$p->id]['renders']); 
        $field->label = $this->_('Renders');
        $fieldset->append($field); 
    
        $inputfields->append($fieldset);
    
      }
    
      public function saveForm($event) {
        $data = wire('modules')->getConfig($this);
        $data['RendersPages'][$this->input->post->id]['renders'] = $this->input->post->renders;
        $this->wire('modules')->saveConfig($this, $data);
      }

     

    • Like 1
  6. 45 minutes ago, flydev 👊🏻 said:

    Hi,

    Which is the class derived from ? Can you paste all the module code ?

     

    Hi

    class Renders extends WireData implements Module, ConfigurableModule {
    
      static public function getModuleInfo() {
        return array(
          'title'    => 'title',
          'summary'  => 'summary',
          'version'  => '1',
          'author'   => 'me',
          'autoload' => true
        );
      }

     

  7. Hello

    this is my snippet

      public function init() {
        if($this->wire('user')->isSuperuser()) {
          $this->wire()->addHookAfter('ProcessPageEdit::buildFormSettings', $this, 'buildForm');
          $this->wire()->addHookBefore('ProcessPageEdit::processInput', $this, 'saveForm');
        }
      }
    
      public function buildForm(HookEvent $event) {
    
        $p = $event->object->getPage();
        $inputfields = $event->return;
    
        $fieldset = $this->wire('modules')->get("InputfieldFieldset");
        $fieldset->attr('id', 'my_fieldset');
        $fieldset->label = __("My Renders");
        $fieldset->collapsed = Inputfield::collapsedYes;
    
        $field = $this->wire('modules')->get("InputfieldTextarea"); 
        $field->attr('name', 'renders'); 
        $field->attr('value', $p->renders); 
        $field->label = $this->_('Renders');
        $fieldset->append($field); 
    
        $inputfields->append($fieldset);
    
      }
    
      public function saveForm($event) {
        $page = $this->pages->get($this->input->post->id);
        $page->set('renders', $this->input->post->renders);
      }

    It builds correctly the inputs, I edit the field renders but when I save the page the value of this inputfield remain blank.

    What's wrong?

  8. Hi @Robin S

    I updated my ready.php including this 

    wire()->addHookBefore('Page::path', function($event) {
      $page = $event->object;
      if($page->id === 1 || $page->template=="_site") return '/';
      $path = '';
      $parents = $page->parents();
      foreach($parents as $parent) if($parent->id > 1 || $parent->template!="_site") $path .= "/{$parent->name}";
      $event->return = $path . '/' . $page->name . '/';
    });

    but nothing different from usual happened... if I tried to log something there's also a Fatal Error

  9. Hello

    I configured the CMS multilanguage with a multisite idea. I created template "_site" and the name of the template is the url of the site interested.
    This installation is used only as API generator. The problem is that $page->url method returns the url with _site name. 

    Now I have this situation
    /[language]/[_site name]/example/example...

    I would like to have this
    /[language]/example/example....

    Is there a way to rewrite this method? The best solution could be a template type check that exclude the _site name in the result.

    This solution should work also when I select a page in CKEditor to set a link.

    Thanks 

  10. Hello

    I have a repeater that contains two field: a page reference and a textarea.
    The page reference is a list of user. With superuser all works correctly but with other roles (that have the correct rights to see and edit user as long as pagereference and repeater) there's a small but very annoying problem. I attach some screenshot

     

    This is what superadmin see. After the #1: and #2: there's the email of the user page reference. The email field is the field that I choose to set as label field.

    superadmin.png.e3f3a1553f406f4f70f557a7fbe7e86d.png

    This is what another role see

    editor.png.a5d162e04362b7571e5b496a2261ec7f.png

    but... the strange thing is that if I open the row, the pagereference is working correctly

    editor_details.png.f5768d082410666a22bf613752f09734.png

    so... what's the problem with non superadmin user? Thanks

  11. Hello

    I created a module to import page and connected the process with a new admin page directly visible in the main menu.
    I also set the permission to the module

    'permission' => 'importposts'

    and add the permission to a particular role

    ... but this link doesn't appear when I'm logged in with the role different to superuser.

    What's wrong?

  12. 41 minutes ago, bernhard said:
    
    // site/ready.php
    $wire->addHookAfter("Inputfield::render", function($event) {
      $field = $event->object;
      if($field->name !== "yourfield") return;
      $event->return = "<a href='foo/bar'>Your link</a>";
    });

    You could use one of the Runtime Markup Inputfields or something like the hook above (untested - just an example to get you started).

    Hi @bernhard and thanks. This would work perfectly in a textfield but unfortunately I have these fields inside a Profields: Textareas and Profields: Table. How can I hook them?

×
×
  • Create New...