kixe

Members
  • Content count

    523
  • Joined

  • Last visited

  • Days Won

    3

kixe last won the day on December 6 2015

kixe had the most liked content!

Community Reputation

682 Excellent

About kixe

  • Rank
    Hero Member

Contact Methods

  • Website URL
    http://qualyweb.com

Profile Information

  • Gender
    Male
  • Location
    Cologne, Germany
  1. Where and how did you define $addPage ? Try var_dump(gettype($addPage)); // 'object' var_dump(get_class($addPage)); // 'ProcessWire\Page'
  2. <img src='{$story->imagefieldname->url}' alt='{$story->imagefieldname->description}' /> // single image field <img src='{$story->imagefieldname->first()->url}' alt='{$story->imagefieldname->first()->description}' /> // multiple images selecting the first https://processwire.com/api/ref/pageimages/ https://processwire.com/api/ref/pageimage/
  3. I completely agree. I don't mind about the absolute sort value, but the page index should be in the right place. In my example it is enough if the page with previous sort value 7 get the index 2, which is the fact if a sort value of 12 is assigned (one more than 11) For handling pages the absolute sort value is not of interest it does say nothing, the index position is the important value. So it would be nice in addition to get the index via $page->index having a setting method. Of course I will do that. https://github.com/processwire/processwire-issues/issues/225
  4. @LostKobrakai I took a look in the core sorting functions. Unfortunately it doesn't work as expected and the $pages API reference is faulty and should be updated: // set $page to have sort=5, moving any 5+ sort pages ahead $pages->sort($page, 5); // works as expected // same as above using alternate syntax $page->sort = 5; // WILL NOT moving any 5+ sort pages ahead it just changes the sort value. Duplicates possible $pages->sort($page); // WILL NOT set anything. This is a getter not a setter. Similar to $page->sort In the $page API reference, $page->sort is described as follow which is faulty too. Use $page->index instead to get expected/ described result. But you cannot use $page->index as a setter! Currently the only (nearly) working solution needs the following 2 steps $pages->sort($page->parent, true); // re-build sort values for children of $page, removing duplicates and gaps $pages->sort($page, 5); // sort +=1 for all pages above In this example you will get an unexpected result If the sort position related to the siblings was 4 before. There will be no change, because there is a gap at sort position 4 now. What I would expect using this function If I set sort I would expect a zero based position related to the page siblings. Example $pages->sort($page, 2); 3 page siblings having the sort values 4, 7, and 11. If I assign a sort value 2 to the page with the former sort value 7 I would expect the page moves to the end (last index number under 3 siblings), but currently it moves in the opposit direction and will be the first one related to its 2 siblings. Nice to have in the future (already available via PageSortMove module) // move page to the first or last position related to its siblings $page->moveFirst; $page->moveLast; $page->moveFirst($newParent = null); $page->moveLast($newParent = null); // move the page to an index position relative to its siblings, optionally change the parent too in one step $page->move($newIndex, $newParent = null); $page->sort = 0; // prepend $page->sort = -1; // append $page->sort = -2; // sort position counted back from the end Expecting a core update related to this I will not push the module to the modules directory. Feel free to pull it from github directly until this is available from core.
  5. Of course I missed them. Thanks for the hint.
  6. http://modules.processwire.com/modules/process-file-edit/ https://processwire.com/talk/topic/14276-file-editor/ http://modules.processwire.com/modules/template-editor/
  7. Of course the selector 'mh_bautraeger.id=mh_bautraeger.id' will give you no result since the value page id cannot be a string. It is always an integer. If I get you right you want to create a page select field providing all pages using template lstg_mainTmpl having a mh_bautraeger selected which is also selected in any (or only one?) other page using mh_mainTmpl. This is not possible via selector but you can do this via custom php code. You find a quick instruction under Input tab in your field setting. The hook should be placed in your /site/ready.php It could be helpful if you describe what the final target of your setting is. Maybe there exist a completely different approach.
  8. Thanks for input. I have been searching for something really short. I am also not sure about the modules name. Any recommendation welcome. I changed the method/ property names to moveFirst and moveLast.
  9. I wrote a module which extends page API. Check out here: It is different from horsts module since it has the capability to sort/ move pages at any place at any time via API or module function and not bound to to page creation only.
  10. This morning I pushed a module to github which extends the page api with moving and sorting capability. https://github.com/kixe/PageSortMove /** * CALLABLE * PageSortMove::execute($pageID, $newIndex = 0, $parentID = null); * $modules->get('PageSortMove')->execute($pageID, $newIndex = 0, $parentID = null); * * EXTENDED PAGE API * @property $page->first // under same parent * @property $page->last * * @method $page->first($parentID = null) * @method $page->last($parentID = null) * @method $page->sort($newIndex) * @method $page->move($newIndex, $parentID = null) */ Have a nice weekend.
  11. @horst Thanks. Didn't know about that. Will have a look inside asap.
  12. If it is not necessary to sort the pages additionally manually the last one can also be the first one if you reverse the order. Just go to the parent template settings select created in Sort settings for children and check Reverse sort direction
  13. If you do not assign a title the autogenerated ID (Inputfield) will be taken. $inputfields->attr('title', 'Weird name'); To put the Inputfields (Tabs) in the right order you could use InputfieldWrapper::insertBefore() or InputfieldWrapper::insertAfter() instead of InputfieldWrapper::add(). Unfortunately this doesn't work in case of ProcessPageEdit. To get it working you need to add another hook to ProcessPageEdit::getTabs() The following code snippet should work. Place it in your /site/ready.php wire()->addHookAfter('ProcessPageEdit::buildForm', function ($event) { $page = $event->object->getPage(); if ($page->template == "bewerbung") { $form = $event->return; $inputfields = new InputfieldWrapper(); $inputfields->attr('title', 'Weird Name'); $inputfields->attr('name+id', 'WeirdTabNameAndId'); // we need both unique ID and Name $markup = wire()->modules->get('InputfieldMarkup'); $markup->label = 'Custom Lable'; $markup->value = '<p>Just a placeholder for any custom markup</p>'; $inputfields->add($markup); $pageEditTab = $form->find('id=ProcessPageEditContent')->first(); $form->insertAfter($inputfields, $pageEditTab); // inserting in the right place is not enough to set the tab order // we need the following hook wire()->addHookAfter('ProcessPageEdit::getTabs', function ($event) { $event->return = array_merge( array_slice($event->return, 0, 1, true), array('WeirdTabNameAndId' => __('Weird Name')), // should be identical to the weird name/title above array_slice($event->return, 1, null, true) ); }); $event->return = $form; } });
  14. Not tested: http://modules.processwire.com/modules/inputfield-textarea-markup/
  15. The topic you found is about modules. If you want to add a tab to your page edit screen you should create a field of type FieldsetTabOpen. Add it to your template and place the inputfields you want to show up under this tab between the opening and closing field.