Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by neosin

  1. @fbg13 that makes complete sense, thank you for this
  2. now I just have to figure out how to access those video template repeater fields through the API
  3. @fbg13 it works! thank you so much, the repeater is what I needed. I am still learning how the PW and the different fields work thanks again
  4. @fbg13 thank you for this, I will investigate repeater fields (I haven't tried them yet) thank you!
  5. @fbg13 thank you, Sorry I don't quite grasp this explanation since the people page only uses "title". Are you saying I need yet another template and fields to merge the "people" and "roles" for each video? The people and roles are "predefined" and exist already Here is my current setup: Template name: videos field: title field: body field: people type: asmselect Template name: people field: title Template name: roles field: title ideally this is what an editor would see when editing a videos template record field "people": [drop down list of names] [drop down list of roles] [button "ADD"] example usage for new video page record: title: Example Video body: Video description people: [ "Bob Smith" ] [ "Producer" ] [ "John Doe" ] [ "Director" ] [ "Bob Smith" ] [ "Catering" ] [ "Bob Smith" ] [ "Sound Editor" ]
  6. I have a template that allows multiple "people" records to be attached (basically tags) however each of those "people" can also have multiple "role's" selected from a drop down. is it possible for tags to have tags and if so how can it be accomplished? For example a "video" data page where the content editor can add multiple people names (via select list) and the roles of each person (via select list) I am probably over complicating this in my head again regarding how to do it in PW, any help de-muddling this in my mind would be much appreciated I have the add multiple names working using asmselect but am not sure how to add the select role option dynamically to each name once added. I am thinking there should be a table with 2 columns where the first column is the user name and the second column is the role and when you insert new record it adds a new row allowing to select a single name and role for the new insert. The "people names" and the "roles" come from different templates since people can have different roles in different videos thank you
  7. @adrian thank you, figures it was in the forum and not the modules section I needed to search lol
  8. @adrian do you have a link for this module? I searched " Settings Factory " in the modules section and it returned zero results. I am curious to check it out thank you
  9. Hi Michael are you using the default "multilanguage installation profile" ? I believe this profile comes with English, German, Finnish languages when you install it.
  10. @SamC Best practice is to sanitize everything a user sends to server, never trust users. It is easy to hack forms using just your browser "developer tools" it lets you change values of everything including all form values. Using your example colors values, the values could be changed to do multiple things from "using unsuported other values" to injecting SQL or PHP code for whatever nefarious purpose. The only time you can relax is if you have predefined values and match those values to what is sent to the server. For example in your case, on form submit you could compare the gridRadios array to a PHP array of values to see if there is any match, if so then data is valid and proceed otherwise reject submission as invalid. but 99.9% of the time it's best to just sanizite user input
  11. I see this frequently when editing existing PageTable fields within a template (in modal) and also directly in setup>fields>pagefield_name this function seems to be the culprit /** * Get the Inputfield used for input by PageTable * * @param Page $page * @param Field $field * @return Inputfield * */ public function getInputfield(Page $page, Field $field) { $inputfield = $this->modules->get('InputfieldPageTable'); $value = $page->getUnformatted($field->name); $inputfield->attr('value', $value); $templateID = $field->template_id; if(!$field->parent_id && !empty($templateID) && $page->numChildren > count($value)) { $orphans = $this->findOrphans($page, $field); if(count($orphans)) $inputfield->setOrphans($orphans); } return $inputfield; }
  12. @adrian tyvm if anyone needs example of insert custom field before other form fields: wire()->addHookAfter('ProcessPageEdit::buildForm', function($event) { $pp = wire('pages')->get(wire('input')->get->id); $form = $event->return; $field = wire('modules')->get("InputfieldMarkup"); $field->label = 'TEST'; $field->value = $pp; $field2 = $form->get('title'); // Field to find and insert new field "before" it $form->insertBefore($field,$field2); });
  13. @adrian thank you, I will use this runtime markup fieldtype On a side note, using hooks how would you put a non editable field at the top of a form? this is what I had come up with before seeing your reply above, the results are it gets added but under the save button. For learning purposes, how would I make it added at the top of the existing form fields (if it is even possible)? wire()->addHookAfter('ProcessPageEdit::buildForm', function($event) { $pp = wire('pages')->get(wire('input')->get->id); $form = $event->return; $field = wire('modules')->get("InputfieldMarkup"); $field->label = 'TEST'; $field->value = $pp; $form->append($field); });
  14. ok this can be deleted, looking at @adrian's redirect module, it seems I need to create a hook in admin.php and then add the field to the form. Sorry, still trying to muddle my way through PW lol
  15. I need to display the page id when view/edit a page in the admin, I am not sure how to do this. Basically it is a field that the user cannot edit, it will show a url to the page with the id in it, like this; www.site.com/en/pageID This is so CMS users can share the short url. I am using @adrian's redirect module to enable redirect using page IDs.
  16. just wanted to mention that this works fantastically for multilingual sites, thanks @adrian yoursite.com/en/pageID yoursite.com/fr/pageID yoursite.com/de/pageID I also modified the module slightly so that the "shortlinks" only display for superuser in the module file public function ready() { // we're interested in page editor only if(wire('page')->process != 'ProcessPageEdit') return; // skip changing templates (only target the actual edit form) $id = (int)$this->input->get->id; if(!$id) return; // wire('page') would be the page with ProcessPageEdit // GET parameter id tells the page that's being edited $this->editedPage = wire('pages')->get($id); // don't even consider system templates if($this->editedPage->template->flags & Template::flagSystem) return; // Display only for superuser so get current user and check if user is superuser $user = wire('users')->getCurrentUser(); if($this->isAllowed($this->editedPage) && $this->editedPage->id != 1 && $user->isSuperuser()){ $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'addShortURLLinks'); } }
  17. @adrian hmm I read the thread but am confused, where is the code example supposed to be saved? I have a few dozen users and am concerned they will add children both via page tree and via the page table, so it is important that the functionality when saving a child is the same for either method used to add new children.
  18. I have a template with a field using profields page table and when I add children they do not get added to the table list automatically. Instead, when I add a child it appears under the table and I must select new children and to add to the table and click save, then they display in the table. The message displayed is " Children were found that may be added to this table. Check the box next to any you would like to add. " Is there a way to have them added automatically to the table when they are created in the admin instead of having to add them afterwards?
  19. any updates for php 7.2+ users ? mcrypt is no longer supported in new versions of PHP (since 7.2) so this module cannot work due to the mcrypt dependency http://php.net/manual/en/migration71.deprecated.php mcrypt has been replaced with OpenSSL I am trying to use the URL shortener module but it requires this module to work
  20. Can someone clarify for me if the external DB is read each time an instance of this field is used or is the external DB used only during initial creation and filling of the values and those values/labels are stored in PW? thank you
  21. @szabesz @gebeer hi thank you both I am looking at how to do this only in the Admin CMS, is it possible? it seems the code you shared is for frontend, can it be done for admin cms ?
  22. can you post template code?
  • Create New...