Jump to content

Martijn Geerts

PW-Moderators
  • Posts

    2,769
  • Joined

  • Last visited

  • Days Won

    31

Everything posted by Martijn Geerts

  1. Without running your code I have just a question: Are you sure that $f->type is a string ? really sure it's not an object ? Have to say that options field is a little bit weird. $options = $f->getOptions(); foreach ($options as $key => $option) { if ($field->isOptionSelected($key)) { $the_value = $option; break; } }
  2. Think Horst or someone who is more knowledgeable then me will respond soon.
  3. I also want to mention that you also can use a file name as PageProcessEditChangeView.js, it's a little more verbosity in the filename but it gives you the flexibility to separate different tasks in separate files.
  4. Most of the time this wire method is not accessed as a constructor. I'll report this one on GitHub.
  5. I want to mention that before you save data (1) You need to know what the data is. (2) Know if it is save to store.
  6. Hi adrianmak, here's a good read: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Markup/MarkupAdminDataTable/MarkupAdminDataTable.module It's not that don't want to fish and cook for you, but fishing your self will give you more experience.
  7. You have something like this: ? public static function getModuleInfo() { return array( 'title' => 'Your title', 'summary' => 'What you want to say.', 'version' => '0.0.7', 'author' => 'adrianmak', // Do you have this ? 'page' => array( 'name' => 'yourname', 'parent' => 'setup', 'title' => 'Your title', ), ); } BTW, When you don't do anything in public function install() or uninstall, you don't need to use them...
  8. Thanks Ivan for making me smile You just have made my day a little bit better !
  9. That's true that limitation is here: https://github.com/ryancramerdesign/ProcessWire/blob/980ce4f0be2054dfbad4a7b334d35bdca42da7da/wire/core/Pages.php#L987 That limitation is there for a good reason as you can see from the code. (needs to do a count on every iteration) I think it's better not to rely on automatic page name when you have that amount of pages with the same title. Maybe you can incorporate the creating date or something to make it more unique, and then write a while loop yourself to make it unique for that date. Or set the title with the date, save the page, change the title to the wished title and save again.
  10. // You need to to have the setting set: return null page if none selected. // When there's no page, a nullpage is returned, that page has ID 0, thus evaluates to false if ($myVariable->pageField->id) echo "<a href='{$myVariable->pageField->url}'>Link to Selected Page</a>";
  11. Just to clarify a few things what is maybe not so obvious when coming from an other CMS. So maybe it's not relevant in your context at all. Anyway ;-), in ProcessWire there's no central place where the CMS stores the files/images (let's call them assets for now). All assets are stored on disk with a page id as reference. The storage of the assets always happen with the field, so that the field is fully responsible for that image. When you delete an image from your field, the image will be deleted from the disk. So when you have a textual reference to the filename but the file is not there anymore, the link is broken. I my self never use images in CKEditor, so I never need to upload images in the context of the CKEditor. However as said before, fields are responsible for the assets, so I guess that behind the scene CKEditor will give the task to a field to upload & store the assets.
  12. When using the Forms API $form->processInput($input->post); will proces the input, but also pre-populate the ->value(s) of the fields.
  13. Admin Page with id = 2, That page executes the ProcessHome module.
  14. Yep, you could do. But I would recommend to use Javascript for that instead of CSS. When you check the javascript config checkbox, you can access the roles in your javascript file with: config.AdminCustomFiles.user.roles
  15. Something like this will redirect you. (not tested) class RedirectToDashboard extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => "Redirect To Dashboard", 'version' => "0.0.1", 'summary' => "Redirect", 'autoload' => true, 'singular' => true, ); } public function init() { $this->addHookBefore("ProcessHome::execute", $this, "redirectTo"); $this->addHookBefore("ProcessPagelist::execute", $this, "redirectTo"); } public function redirectTo($event) { if (!$this->user->isSuperuser()) { $this->wire('session')->redirect('/processwire/setup/dashboard/'); } } }
  16. Thats true... as it should. when using: if ($childpages) you ask: If PageArray... which is always true. You should check if it contains pages with count for example. if (!count($childpages)) { // The pageArray doesn't contain pages // If not count pages, thus 0 } if (count($childpages)) { // yay we have at least 1 page } // or if ($childpages->count()) { // yay we have at least 1 page }
  17. if ($page->draft_article) will always return true, no matter if it is published or not. Remember that $page->draft_article is an object, so you're asking if (object) Probably you're better of with: $page->draft_article->viewable() or $page->draft_article->editable() or something. if ($page->draft_article->id && $page->draft_article->viewable()) { } I'm nor saying this is a solution, but it it can get you started.
  18. Images are stored as soon as they are on disk so it depends on upload speed. Not much you can do about it.
  19. I think it is possible to change the language of the datepicker with javascript: http://jsfiddle.net/repw4/418/
×
×
  • Create New...