So my question is can I use a bunch of steps defined in another scenario that was used in a different feature file?
eg: I have a feature file that helps create some pages on the website. Now i want a different scenario in a different feature file that will create the pages and also add some other steps to it. In this case, I want to create a page, and this triggers a notification to a particular user, and I want to work with the notifications. But cannot do so without triggering a page creation action by the user. It is just a bunch of 5 steps. but i am trying to reduce steps as much as possible to keep it simple.
Of the top of my head, maybe use tags and then use the tags to combine two scenarios. but i am not sure if we can do that
So i want to know if there is a way of code reuse in this case. And if so, HOW?
Thank you
You could define a new step like ‘I create a page’, and under the hood reuse the steps from other contexts as explained here:
https://behat-docs.readthedocs.io/en/mvp1.0/cookbooks/gathering_contexts_when_using_multiple_contexts.html
Related
I want my generated Firebase dynamic links be usable just for one time.
After the first person used the link, we need to prevent the second use of that specific dynamic link.
Is there such a feature build in Firebase dynamic link ? or I should implement it manually inside my app
No, Dynamics Links are designed to be useful to anyone who has the link. There is no way to limit their usage. That would be something you'd have to implement yourself with your own backend.
I am trying to add a dynamic link to a Flutter app but I need this link to work only once when generated as this will be a sharing option that might contain data I do not want to be lingering around for long after. I have been trying to find any docs on how to do this but have not been able to find anything that explains how to do this.
Is there any way to generate this single use link? Or does anyone have any recommendations on a way to implement this? Making sure a link gets used once and only once?
I am facing an issue with wordpress. I have two sites. On the first site there is a form that takes inputs and stores values in custom fields to be later used for various calculations on that site.
On the other website, I need to access these same values from the first website and use them thoughout the second website in multiple elements. So I've come up with an idea that because those stored values on the first website are already being displayed (as in, they are in some HTML elements in a visible page), I could just get that first website content and than do one of two things:
Create similar custom fields in the second website, and write a function in functions.php that would take the values from the first website and update custom fields in the second website every time it loads, so then I could use those values throughout the second website (it seems to me that this is a stupid solution).
Write a function in functions.php (in the second website, the one that needs to receive the values from the first) that would create javascript variables from that first website, so that could be used to populate all the elements I need.
Maybe there is some much better solution for all of this. To be fair, this is the first time I am doing something like this, so you could say I am very unexperienced.
Is there another better solution for this? And if there isn't, which of the two solutions listed above is a better one?
Though there are many possible options and that may generate debates based on individuals' experiences and or prevailing conditions, you can easily achieve your intended goal by consuming data from your site one into your site two, then, apply whatever necessary logic and actions needed there (in your site two).
Using the latest version of WordPress, you can take leverage on the in-built REST API in order to access the desired data from site one within site two.
Let's start with basic thing, simple example is Yii. It has such thing as widgets. Standalone, configurable and callable from any place we want classes. And I'm wondering can symfony2 has the same? What it will be? Controller in bundle? Action simple (method)? Widget (twig) with parameters?
In Yii we create class (of widget), standalone, describe it and use (by calling in template). How will it look like in symfony2?
Simple example 'i want create menu navigation using widget, where it will construct html by user roles'.
Symfony doesn't provide such a feature however you can make them yourself. They are few ways of doing it.
I'll just admit that we are talking about widgets that could do backend work (i.e. get data from DB, call an API, etc.).
1 - The scalable way
The use of the render tag in Twig which allows you to call a controller action from a template. It's scalable because you could use esi tags with Varnish (you can also implement your own caching profiles).
As a bonus, the profiler will show details about the specific render calls in the timeline (it will look like a subset of the entire request).
2 - Include a template
The included template gathers the data through a Twig function call. By experience, it's a bit faster than the first solution however it's not easily scalable.
3 - Render through a custom TwigExtension
The twig function will get the data and call the renderView method of the template service. If you are planning on doing this, you probably want to use the first method.
Conclusion
If you have a big website with modules/widgets that gets a lot of traffic (or "hit"): use the first solution.
If you have a small website with no support for caching: use the second solution. You'd use this solution if the module/widget is super light.
If you are thinking about the third solution... it's probably a good idea to use the first solution.
Personally, I'll always try to use the first solution and try to boost the performance one way or another. The render call in Twig has been significantly improved since the last versions of Symfony2.
Hopefully, my answer will provide you some guidelines.
Am I able to add the following field to a content type, so that each piece of content I create can be conditioned to a page?
Or is there a module to extend Publishing Options, where by it adds all the pages I have created (just like 'Promote to Front Page')?
If not, why is no one doing this? As a new user to Drupal this seems like it would be a handy operation. (I have already tried this module but it doesn't achieve the results I'm after).
If none of these solutions are available, what would be the best alternative way of doing this?
I've posted this question on Stack Exchange for Drupal but I need a quick answer and there seems to be a bigger community here :D
You should use Context. With Context, you'll be able to manage contextual conditions and reactions for your drupal like Regions.
Have you used Views? it is one of the most common used drupal modules. It doesn't extend publishing options directly but it does replace it in a way. You can say by example put a list of al content-types: your_own_Content_type that have the publishing options of promoted to front-page. then sort them by title, date, what ever you like.
you could also create only one view and create multiple blocks out of it. you have to understand the logic of drupal: if you want different blocks on different pages, you have to create the different pages AND different blocks
create the view for one type of content-type and make one block out of it. put this block on the desired page. All your other blocks are made with the same view, just adjust a condition in your view and create a new block out of it. You should also put all your blocks in the same region, and set the to the right pages
here you can find a lot of documentation if you run into any problems... drupal.org/project/views
Views is the best at creating a slideshow of images or any type of data on your site.
Used in combination with nodequeue it might offer near or the full functionality you are trying to achieve (check this out ... and this too) - but I don't understand your question entirely.
By my opinion Views is too complicated task for much simple request.
There is a few ideas for solution:
Easy way - You can create a specific template file or add some if statments to the node.tpl.php(specific tpl better)
For minor changes - Create a new context with "path" filter and "theme html" reaction, than hide the field by the css
Best but complicated(large usages) - create a new "view mode" and implement the display by new "hook_menu".
~ Almog