Jump to content

Robin S

Members
  • Posts

    4,792
  • Joined

  • Days Won

    303

Everything posted by Robin S

  1. Besides Repeater and PageTable, there are Table and Multiplier in the ProFields package that can be used for repeating content. But for a simple repeatable text string you could just use a textarea field and explode() on newline to get an array of values. $values = explode("\n", str_replace("\r", '', $page->my_textarea));
  2. If $config->domain is staging.domain.com (it already includes a subdomain) then that makes your httpHosts array resolve as: staging.domain.com, www.staging.domain.com, assets0.staging.domain.com, assets1.staging.domain.com, assets2.staging.domain.com, assets3.staging.domain.com So instead you probably want something like: $config->domain = 'domain.com'; $config->httpHosts = [ $config->domain, "staging.$config->domain", "www.$config->domain", "assets0.$config->domain", "assets1.$config->domain", "assets2.$config->domain", "assets3.$config->domain" ];
  3. Front-end editing works okay for me when using $page->render(). If you are using "Option A" for front-end editing make sure you have selected "Fields editable regardless of page". But a couple of observations: 1. Do you really need to be rendering pages? Can you not just get your pages into a PageArray and iterate over them, echoing the fields you want? $items = $pages->find("template=my_template"); foreach($items as $item) { echo "<h3>$item->title</h3>"; echo $item->body; // etc } If you're sure you need to render you might be better off using $files->render() as it is better documented than $page->render(). 2. In your code... ...you are overwriting the core API $modules variable. You should choose a different name for your variable.
  4. Hi @adrian - with the change, the editor paths are working properly for me in all of these places.
  5. Can you incorporate the logic into "Custom PHP code to find selectable pages"?
  6. The ImportPagesCSV module does not include a permission in the getModuleInfo() method, so you would need to edit the module file to add one. Bear in mind that this would be overwritten if you later update the module. public static function getModuleInfo() { return array( 'title' => 'Import Pages from CSV', 'version' => 106, 'summary' => 'Import CSV files to create ProcessWire pages.', 'singular' => true, 'autoload' => false, 'permission' => 'import-csv', ); } Refresh the module cache, create custom permission 'import-csv' and give that permission to any role that is allowed to use the module.
  7. This thread may be related: Try clearing the module cache and see if that fixes your issue.
  8. I can confirm. Looking at the Pages table in the DB there are no Home page children with sort values of 0, 1 or 2. Maybe raise a GitHub issue for this? It does. From the API reference... $page->sort int Sort order of this page relative to siblings (applicable when manual sorting is used).
  9. You could try adding some padding to the bottom of the Form Builder iframe to allow for the height of the datepicker: #FormBuilderViewport_myformname { padding-bottom:200px; }
  10. I haven't tried it, but there is this: https://github.com/Reinmar/ckeditor-plugin-descriptionlist
  11. @szabesz: I updated the code examples.
  12. Happy to do that. I'm just about to head away for a few days but will go through systematically when I'm back.
  13. If you removed /site/config.php that will definitely cause a problem. No need to touch that file when upgrading.
  14. This pretty much works - it just misses out the trailing slash from the original $compilerCachePath so results in a double slash in the link URL. But this could be corrected: $compilerCachePath = realpath($compilerCachePath) . DIRECTORY_SEPARATOR; Alternatively, slash replacement could be done conditional on what the directory separator is (thereby distinguishing Windows from Mac/Linux): if(DIRECTORY_SEPARATOR == '\\') $compilerCachePath = str_replace('/', '\\', $compilerCachePath); Or no conditional needed for this one: $compilerCachePath = str_replace('/', DIRECTORY_SEPARATOR, $compilerCachePath);
  15. Oh right, of course. Yes, that would work. You're right. I'm just being lazy and leaving the file watcher at the default scope, which is all project files. But I could define a custom scope for each project, or use the preset "open files" scope and just be careful not to accidentally open AdminOnSteroids.scss
  16. Thanks, that wouldn't help because the file would still be within the project scope (the whole PW installation is). Somehow AdminOnSteroids.scss would need to be excluded from the module files that are downloaded/installed from GitHub. I'm not very familiar with Git so not sure what options there are for that. Or a different file extension used? I guess that would foul up things at your end. Maybe it has to go into the too-hard basket. I actually only need the SCSS file watcher active while the site is at the static stage, so I probably just need to remember to turn it off afterwards.
  17. @adrian - sorry for the delay. The change you suggested doesn't allow the file compiler path to be successfully replaced. For me the $compilerCachePath variable before the change is... D:/Websites/pw3-testing/site/assets/cache/FileCompiler/ ...and after the change it is... D:/Websites/pw3-testing/site/assets/cache/FileCompiler\ ...but to successfully replace the link to the editor it needs to be... D:\Websites\pw3-testing\site\assets\cache\FileCompiler\ I originally thought my str_replace suggestion was hacky but now I see there is already something similar in the nette/tracy source so maybe it is an okay way to deal with these path issues?
  18. @tpr - Is AdminOnSteroids.scss a necessary part of the module, or is this file only used by yourself to generate AdminOnSteroids.css? Just wondering if it could be excluded from the GitHub repository - the issue I'm striking is the when developing locally PhpStorm's SCSS file watcher will automatically compile from AdminOnSteroids.scss and overwrite AdminOnSteroids.css, producing a different result. If it is a necessary part of the module that's fine - it's possible to avoid this at my end by defining a custom scope for the file watcher, just requires a bit more setup in each project.
  19. Thanks, I see now what the module author was trying to do. The problem is the CSS targets the wrapping list item as well as the text input. For a basic fix you can just change the CSS file so it consists only of: li.InputfieldAssistedURL input[type="text"] { width:75%; } Or you could add some wrapping divs in the render method that would let you achieve more precise styling: public function ___render() { $field = new InputfieldURL(); $field->set('name', $this->attr('name')); $field->set('value', $this->attr('value')); $field->set('class', 'InputfieldAssistedURL'); $btn = $this->modules->get('InputfieldButton'); $btn->attr('id', $this->attr('name') . "_assistedurl_open"); $btn->attr('data-page-id', $this->page->id); $btn->class .= " InputfieldAssistedURLOpen"; $btn->icon = 'link'; $btn->value = ''; $out = '<div class="InputfieldAssistedUrlButton">' . $btn->render() . '</div>'; $out .= '<div class="InputfieldAssistedUrlText">' . $field->render() . '</div>'; return $out; } .InputfieldAssistedUrlButton { float:left; width:60px; } .InputfieldAssistedUrlText { margin-left:60px; padding-top:6px; }
  20. I see. The fix for that is nice and easy - remove this: https://github.com/marcostoll/processwire-fieldtype-assisted-url/blob/master/InputfieldAssistedURL.css#L6
  21. I believe the code you're showing there comes from the render() method of InputfieldAssistedURL.module If you want to modify the module directly you would need to add a construct() method to set the prependMarkup and appendMarkup properties. public function __construct() { parent::__construct(); $this->prependMarkup = '<div class="InputfieldAssistedURLWrapper">'; $this->appendMarkup = '</div>'; } But probably better not to modify the module and rather set your custom properties in a hook. In /site/ready.php: $this->addHookBefore('InputfieldAssistedURL::render', function($event) { $inputfield = $event->object; $inputfield->prependMarkup = '<div class="InputfieldAssistedURLWrapper">'; $inputfield->appendMarkup = '</div>'; });
  22. The methods for setting new options for an Options field via the API seem to be a bit convoluted - I think it's probably an oversight and it would be worth raising a feature request at GitHub. There's a method that seems to be primarily intended for the admin back-end: setOptionsString(). You can use it but the way the options are defined (string with line break separator) is a bit weird for API use and it's not easy to get it to play nicely with existing options. $f = $fields->my_options_field; $manager = new SelectableOptionManager(); $options = 'red green blue'; // you can also set IDs and values if needed $manager->setOptionsString($f, $options, false); // if last argument is omitted/true you will remove any existing options Otherwise you could manually create SelectableOption objects, add them to a SelectableOptionArray, and use addOptions(), deleteOptions(), setOptions(), etc, with that SelectableOptionArray. See the module source code. It's hardly a simple process though. I think what's needed are methods to go from options to PHP array and PHP array to options.
  23. It's in the modules directory here: http://modules.processwire.com/modules/fieldtype-assisted-url/
  24. It works for me - what part isn't working for you? $result = $page->getUnformatted('my_pagetable_field')->first(); echo $result->my_image_field->first()->url;
  25. @szabesz - I had a play around to see how you could use custom PHP replacements in the description field. My first thought was create a module where you define tag/code pairs in the module config, then look for and replace those in descriptions. This works, but requires the use of eval() and conventional wisdom is that eval() is evil. So my next thought was Hanna Code, and this seems to work great. In ready.php (or create an autoload module): $this->addHookBefore('Inputfield::render', function($event) { if(!$this->wire('modules')->isInstalled('TextformatterHannaCode')) return; if(!($this->wire('process') && $this->wire('process')->className() == 'ProcessPageEdit')) return; $inputfield = $event->object; $description = $inputfield->description; if($description == '') return; $this->wire('modules')->TextformatterHannaCode->formatValue(new Page(), new Field(), $description); $inputfield->description = $description; }); Then set up the Hanna codes you want to use in description fields. If you want to get the page object for the page being edited then add this at the top of your Hanna code... if($process && $process->className() == 'ProcessPageEdit') { $p = $process->getPage(); } else { return "[Hanna code '$hanna->name' is not valid for this field]"; } return $p->url; // an example to return the URL to the page without scheme and hostname ...then access the page object as $p
×
×
  • Create New...