Jump to content

Clarity

Members
  • Posts

    125
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Clarity

  1. Hello everyone! Recently I wrote these scripts for TracyDebugger console in order to make work with RepeaterMatrix easier and faster. I want to present them to the community. Show relationship between all types, names and labels. $repeaterMatrixModule = $modules->get('FieldtypeRepeaterMatrix'); $fieldName = 'content_blocks'; $repeaterMatrixField = $fields->get($fieldName); $typesArray = []; foreach($repeaterMatrixModule->getMatrixTypes() as $matrixName => $matrixType) { $typesArray[$matrixName] = $matrixType . ' ' . $repeaterMatrixModule->getMatrixTypeLabel($matrixType, $repeaterMatrixField); } db($typesArray); Show all pages which have specific type in field (repeater_matrix) with this name: $repeaterMatrixModule = $modules->get('FieldtypeRepeaterMatrix'); $typeName = 'block_text'; $fieldName = 'content_blocks'; $repeaterMatrixField = $fields->get($fieldName); $typeId = $repeaterMatrixModule->getMatrixTypeByName($typeName, $repeaterMatrixField); $typeLabel = $repeaterMatrixModule->getMatrixTypeLabel($typeId, $repeaterMatrixField); $pagesWithType = $pages->find("{$fieldName}.type={$typeName}"); db($pagesWithType); db($typeLabel, 'Name of type'); This list can be continued as soon as I'll invent more scripts.
  2. Hello everyone! I'm using TinyMCE module and I want to insert a table to the page. However, I don't need an attribute "border" to be automatically appended to the table. Can you please tell me how to get rid of this in a proper way?
  3. Thank you! I already did it. My code was the following (in search view): <?php if($q = $sanitizer->selectorValue($input->get('q'))): ?> <?php if($pages->find('search_index%=' . $q)->count): ?> <?= $searchEngine->renderResults() ?> <?php else: ?> <?= $searchEngine->renderResults([], $searchEngine->find(Utils::handleSearch($q))) ?> <?php endif; ?> <?php endif; ?> I check first if there are search results in normal keyboard layout and then invert keyboard layout using Utils::handleSearch() method if there aren't any results.
  4. Hello, @BrendonKoz! I need to change the erroneous keyboard layout after user performs the search. For example, I wrote 'ghbdtn' and that's supposed to be 'привет' (hello) on Russian. The code shown by the link is not similar to what I have. I'm using the following code ($searchEngine is a variable which contains the module): <head> ... <?= $searchEngine->renderStyles() ?> <?= $searchEngine->renderScripts() ?> ... </head> <body> ... <?= $searchEngine->renderForm() ?> ... <?= $searchEngine->renderResults() ?> ... </body>
  5. Hello, @teppo and everyone! Can you please tell me how to modify the query during search?
  6. Hello everyone! I'm using "use" statement in controller like this: <?php namespace Wireframe\Component\MyComponent; use Wireframe\Lib\Utils; class MyComponent extends \Wireframe\Component { ... } Then it works in component view iff I write use Wireframe\Lib\Utils; in component view, otherwise I get an error: Class "ProcessWire\Utils" not found. Can you please tell me if it is possible to use utility class in component view if it is explicitly used only in component controller?
  7. Hello everyone and @kongondo! Can you please tell me how to create a dynamic menu using your module? Where URLs of pages are relative not to a whole site, but to every page where we use this menu.
  8. Hello everyone! Can you please tell me how to save a page after other page becomes hidden? Something like: $wire->addHookAfter('Pages::hide', function($event) { if(wire()->page->id == $event->arguments('page')->id) { wire()->pages->find('selector for page')->save(); } }); But Pages::hide won't work because class Pages doesn't have such a method. Which method of which class should I use?
  9. Hello everyone and @ukyo! Can you please tell me how to deal with this error? Argument 1 passed to ProcessWire\FieldtypeMystique::loadResource() must be of the type string, null given, called in /home/i/ivangr/tverkurort.ru/public_html/site/modules/Mystique/InputfieldMystique.module.php on line 175. My Mystique code is: <?php namespace ProcessWire; return function ($page = null, $field = null, $value = null) { ... };
  10. Hello everyone! Can you please tell me how to exclude hidden repeater fields via API? E.g. something like $page->repeater->find('exclude=hidden').
  11. If I'll really need PageReference, I think I can use hook + JS which was mentioned in the topic above. However, I found that using PageReference for my needs is superfluous, I can simply use ->find() method instead.
  12. I found a solution: increased numPageLinks from 5 to 10.
  13. Hello everyone! I have an issue with MarkupPagerNav module. When I have 6 pages and stay on pages 1-4, the separatorItemLabel is being shown between 5 and 6 while it shouldn't. My options are following: $options = array( 'numPageLinks' => 5, 'nextItemLabel' => '>>', 'nextItemClass' => '', 'previousItemLabel' => '<<', 'previousItemClass' => '', 'lastItemClass' => '', 'currentItemClass' => 'active', 'separatorItemLabel' => '<span>&hellip;</span>', 'separatorItemClass' => '', 'listMarkup' => "<ul>{out}</ul>", 'itemMarkup' => "<li>{out}</li>", 'linkMarkup' => "<a href='{url}'>{out}</a>", 'currentLinkMarkup' => "<span class='current-page' href='{url}'>{out}</span>" ); Can you please tell me where I am wrong?
  14. Hello everyone! I have a PageReference field and I need to get a selector of resulting PageArray for the purpose of setting the limit of these pages in order to use it in the pagination. Can you please give me an advice?
  15. Hello everyone! I have a HTML code for the form: <form class="contact-form" action="/ajax-handler/" method="POST"> <input type="text" placeholder="Name"> <input type="text" placeholder="Phone"> <input type="text" placeholder="Message"> <button type="submit">Submit</button> </form> I have an JS code which handles it via AJAX request: $(function() { var form = $('.contact-form'); $(form).submit(function(e) { e.preventDefault(); var formData = $(form).serialize(); $.ajax({ type: 'POST', url: $(form).attr('action'), data: formData }) .done(function(response) { alert(1); }) }); }); However, when I open "Network" tab in Dev Tools, I see that the request goes to the same page where the form is being placed, not to /ajax-handler/ page. Can you please tell me where I was wrong?
  16. Hello everyone! Can you please tell me how to convert Pageimages collection to plain array?
  17. Yes, it works too. Thank you for the advice. Let me think about it. Thank you about the explanation. ? Thank you for the addition.
  18. Well, my code is like this: <?php namespace Wireframe\Controller; class Test extends \Wireframe\Controller { public function init() { $var = $this->foo(); $this->var = $this->foo(); $this->view->var = $this->foo(); bd($var); // 1 bd($this->var); // null bd($this->view->var); // 1 } public function foo() { return 1; } }
  19. Hello, @AndZyk! Yes, I think it might be the reason. Using $this->view in Wireframe instead of $this resolved my problem.
  20. Thank you, I already found that I can use additional single-valued Page Reference for my purposes.
  21. Sorry if I was unclear, but it's not quite what I want. I need all pages with this Page Reference and with given in the selector value of the first element of this Page Reference, not the first page with this Page Reference.
×
×
  • Create New...