I was just wondering if there was a super quick way to automatically add a filtering system into Drupal views.
I.e. I just need to add in the top of my view search by name (text box) and search by category (drop down box)
Or do I just manually create this form then use the filter agruments within the edit view screen?
I found the answer.
It's part of the Views Module under filters - then you just expose them, simple...
Not sure what Daniel was on about?
I dont understand exactly you question, but have you tryed VBO?
However, when you create a view you can 'expose' the filters you use, so the user can change it in the view page.
Related
I am new to Joomla component developement and currently fighting with certain basic design patterns!
Lets say, I am developing a component where users can enter simple notes into their personal notebooks.
On calling the view "index.php?option=com_notebook&view=notes" I simply show a list of all note entries of the user. No problem so far, this is working fine.
Now I want to extend my component with the following feature: on opening the view "index.php?option=com_notebook&view=notes", I want to check if the user has already created a notebook before. If yes, I show all note entries, if not, I want to load a different view which contains a form to create a new notebook with certain options.
But how can this be done in a clean way?
For sure, I just can implement the form within the view "notes", but this is not the clean way, isnt it?
I also tried to override the function "display()" of the main controller and set the view manually if no notebook exists. But if I do so, I have to handle all calls to other views of my component manually within the function "display()". To solve this, I created a copy the original implementation from the class "JControllerLegacy" and changed it to my needs - this is working - but is this really the best way to handle problems like this?
So I ask you, what is the best approach to solve this problem?
Thx a lot!
According to me the best solution of your problem is to provide "New" and "Edit" button to your notebook listing page and create edit view of notbook. Same as Joomla has articles and article views.
So, As you mentioned above if use dose not have any notebook then he/she can create a new notebook using that "New" button. when user clicked on "New" button he has blank form where he/she can create new notebook.
here is the example how to create listing and edit view in Joomla. Hope this will help you.
https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Adding_backend_actions
I want to create a wordpress blog template. Like other themes have I don't just want one layout for my blog index page (home.php). I want to have the option that the user can select between 2 columns, 3 columns, some custom layout etc.
I know I could achieve this with static pages. But for the blog index there should not be static pages. So can anyone tell me how to achieve this?
I am not exactly sure what you are asking.
Do you want your users to be able to pick from different layouts? In that case, write the layouts in HTML(you can use a frontend framework like Bootstrap to help you), use PHP to detect the user's choice(storing it in a cookie, for instance, and setting the value of the cookie with a simple form and post), and echo only the layout you'd like.
If that's not what you're asking, please update your question with some examples.
I want to change the way Drupal builds specific fields on a specific node edit/add form on my site. For example, when I use print drupal_render($form['textarea']); in my node--CONTENTTYPE--form.tpl.php file, I get the default Drupal render of the field widget. I want to modify the HTML markup of the field widget.
There are three ways I can think of that might solve this problem:
Using a forms equivalent of the theme_field() hook. This seems ideal, but after searching for the last few hours, I haven't found anything on this.
Building custom field widgets for every field type I'm using on that node. This is definitely not ideal and I have to believe there's an easy way to do this in Drupal from a theme point of view.
Manually build the HTML markup for the form and field in node--CONTENTTYPE--form.tpl.php with print $form['textarea']['und'][0]['title']; and the like.
Is there a hook in Drupal to do this, or must the code for every field I want to modify be manually generated?
I think the hooks you are looking for are hook_form_alter and hook_form_BASE_FORM_ID_alter. Refer to the Form API to know what you can set on the render array.
Let's say I'm making a blog in Drupal 7, and I want my end user to see a link: "Add Post", and when he clicks on that link he can add a new content. But instead of the default administration page, is it possible to create a new one, which has just the post title, tags, message and etc?
I've been searching for 2 days now, founding nothing about where to start/how to start a specific administration page instead of the default one.
You will have to create a specific module for that which will:
define the blog post editing form you want to have
define a page through a hook_menu function that includes the form
define a menu entry for it in the administrative menu
etc.
You should really get a little more into extending drupal by reading some pro drupal 7 book.
At least start reading http://drupal.org/node/1074360
Another very good starting point is the drupal "examples" module, which provides example code for most things your modules need to do:
http://drupal.org/project/examples
You could probably do all you need to by adding a template for the blog posting page to your theme. This lets you customise the display of the form, without needing to get too deep into Drupal programming.
Alternatively, you could create a module to replace the default blog submission form with one if your own design.
The theming and module design guides on the Drupal website give lits if detail on both these approaches.
James
you can have a different theme for management section, you can have multiple permissions depending on role, you can customize any page using ***node.tpl
Every add/content_type is a form. Forms can be altered with hook_form_alter or hook_form_id_alter.
If you want to have different fields that are shown for different roles, first see if it could be done on the admin/people/permissions page, if not write extra if conditions inside the form_alter.
e.g. check user role:
global $user;
// Check to see if $user doesn't have the administrator role.
if (!in_array('administrator', array_values($user->roles))) {
// Alter the form
}
You can check the form variables with dpm($form) when the Devel modules is enabled.
I want to use a template override for Articles in Joomla, therefore I am using
mytemplate/html/com_content/article/default.php
If I change anything in this file the changes do appear.
But as I want to use an extra .php-file f.e.
mytemplate/html/com_content/article/alternativeLayout.php
I am facing a problem. Because although I can select this layout on the article settings page - any Changes I make do not appear and still the default.php is used.
Any ideas what I am doing wrong?
In order for an alternative layout to be used, two conditions must be met -
You must select the layout in the article parameters
No menu item can exist for this item - the layout selection of the menu item will override the selection in the article parameters
It sounds like your problem is with #2.
EDIT
Duh, I missed the key part of using alternate layouts. In order to be able to use an alternate layout with a menu item, you have to create an alternatelayout.xml file and place it in the override folder. This will give you an additional menu item option that you select when creating your menu item. You should be able to copy the defailt.xml file and edit it for the new layout.
I created a visual tutorial for this as it was driving me mad for about two days until I figured out how to actually work it. You can find it here: Joomla custom article template
I hope it helps others solve this faster than I did :-)
PS: all the credit for the article goes to Brent!!
the name of the files must be the same. The override must have the name "default". So its:
/yourTemplate/html/com_content/article/default.php
/yourTemplate/html/com_content/article/default.xml
/yourTemplate/html/com_content/article/default_links.php
had exactly the same problem, this solution solved it.
Also, note that any override filenames must be lower case. For example, "AboutPage.php" won't work.