Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by webdecker

  1. What about the examples on https://processwire.com/api/ref/page/delete/? Due to processwire's database structure it seems almost impossible to delete records directly in the database... 😐 I would do such things in a template file. You asked "via the console" - yet I don't no such way, but I'm curious, how could such a way look like?
  2. If your "$terms = ..." code is really the first line in a .module file and not within a class method, then I would expect, that it won't work. It would be executed when the .module php file is loaded and I guess at this very early moment the whole machinery is not yet ready. Have you tried to write this line in a module's init() or ready() method or in ready.php?
  3. If I got it right, you are looking for pages having a (page)file (in field "file_field") named like something? Do you mean something like this...? $fieldname = 'file'; // or 'file_field' for your case...? $search = 'partofthename'; // V1 via api... $pgs = $pages->find("{$fieldname}%={$search}"); foreach ($pgs as $p) { echo "{$p->id} {$p->title}<br>\n"; } // V2 via database and api... $pgids = array_column( $this->database->query("select `pages_id` from `field_{$fieldname}` where `data` like '%" . addslashes($search) . "%'")->fetchAll(PDO::FETCH_OBJ), "pages_id" ); $pgs = $pages->find("id=" . ($pgids ? implode("|", $pgids) : "0")); foreach ($pgs as $p) { echo "{$p->id} {$p->title}<br>\n"; }
  4. @theo: I just installed it and made a quick test. Great!
  5. Sorry, too fast... My statement only works for labels and description, not for options, because InputfieldRadios for exmaple always sets $label = $this->entityEncode($label, Inputfield::textFormatBasic); - ignoring the field's textFormat setting ... ? So for options the above mentioned hook hack seems to be the way...
  6. Hi, I don't know FormBuilder yet, but if I prepare a form like this... $form = $modules->get("InputfieldForm"); //... $field = $modules->get("InputfieldText"); $field->label = 'Multi<br>line<br>label'; $field->description = 'Multi<br>line<br><span style="color:red;">description</span>'; $field->attr('id+name','testfield'); $form->append($field); //... ... to be able to pass HTML code to labels and descriptions of form fields I can set ... $field->entityEncodeLabel = Inputfield::textFormatMarkdown; $field->entityEncodeText = Inputfield::textFormatMarkdown; $field->textFormat = Inputfield::textFormatMarkdown; (ProcessWire 3.0.165, don't know whether it also applies for earlier versions...) This can probably be used in the hook mentioned before, too. Unfortunately a <p> tag is rendered around such a label, but I add to my CSS ... label p { display: inline-block; margin: 0; padding: 0; } ... and then it's ok.
  • Create New...