The module will allow Developers and Site builders to specify callback function in Views to generate titles dynamically for display types like Page, Block, Content Pane.

My project page can be found here: https://www.drupal.org/sandbox/nikunjkotecha/2693817

The git clone command would be:

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/nikunjkotecha/2693817.git views_title_callback

This is my first project that I am actually submitting to the Drupal world so I have no references. Any comments, suggestions, or advice is welcome.

Comments

nikunjkotecha created an issue. See original summary.

PA robot’s picture

Status: Active » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxnikunjkotecha2693817git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

nikunjkotecha’s picture

Status: Needs work » Active

Refactored code, only class name errors left in pareview.sh report which I am assuming are not valid since it is asking for Camel case in D7.
Removed LICENSE.txt, it will be added by drupal.org packaging automatically.

th_tushar’s picture

@nikunjkotecha, first of all thanks for contribution!

Here is my assumptions on your code after manual review:

  1. Add hook_help() to your module.
    1. The code looks fine. Will check the functionality of the module after installation.

      Code too short
      This project is too short to approve you as git vetted user. We are currently discussing how much code we need, but everything with less than 120 lines of code or less than 5 functions cannot be seriously reviewed. However, we can promote this single project manually to a full project for you.

      Adding Pareview: Single Project Promote tag.

      Thanks again!!

klausi’s picture

@th_tushar: I think you forgot to change the status. Is there any blocker left after your review or is this now RTBC?

nikunjkotecha’s picture

Thanks Tushar for the review and suggestion, I have added hook_help now to display the help on module overview page.

Also, about the size and limitation, I understand communities decision to have some minimum amount of code and I'm fine to have this promoted alone without the permission to do it myself. The functionality as you can see doesn't require too much of code and I found this really helpful as I have faced this problem in multiple projects, which triggered me to create a separate project for it.

Thanks again for your time reviewing this.

th_tushar’s picture

@klausi,

I didn't change to RTBC, as I need to install and check the module functionality.

klausi’s picture

@th_tushar: that's nice if you want to do that, but not absolutely necessary. If you are confident from your code review that the applicant knows what they are doing and there are no security issues jumping out, then an RTBC is fine.

th_tushar’s picture

Status: Active » Needs work

HI @nikunjkotecha,

I have installed your module to check the functionality, the module got installed without any errors.

But the functionality of the module was not working. In views configuration, I have given the custom callback function written in my custom module, saved the view. But when accessed the view, the custom title callback wasn't being called. Also when the callback didn't exists, there may be a PHP Fatal error which will break the site. This should also be handled.

While manual code review, I found that the $empty variable is being assigned a value and immediately being overridden by the boolean value. Please check the below code.

  /**
   * Inserts the code into the view display.
   */
  public function options_submit(&$form, &$form_state) {
    $new_option = $form_state['values']['title_callback'];
    switch ($form_state['section']) {
      case 'title_callback':
        $this->display->set_option('title_callback', $new_option);
        $empty = trim($new_option); - assigning a value
        $empty = empty($empty); - being overridden by boolean value.
        break;
    }
  }

Changing the status to "Needs work". Please check above issues and mark the status back to "Needs review".

nikunjkotecha’s picture

Hi Tushar,

Can we chat or something to check the issue?

  • About fatal error: I have added check using function_exists().
  • Function not getting called, need to check it as it works fine for me in my current project.
  • $empty - yeah it's not used, silly me I didn't check the whole code that I copied from views_access_callback module. This is actually copied from that module. You can see my module page, I have used code from cpv and views_access_callback (proven and tested code)

I've made a commit after removing $empty part, let me know best possible way to discuss about why it's not working for you. I'll try and create a demo of this and post URL in module page and here tonight.

nikunjkotecha’s picture

@Tushar,

I have created a custom module and hosted on Github

l have created a demo site and used this module on the site to demonstrate use of the function.

Change the filter of Tag on the site to see change in the title.

Let me know.

th_tushar’s picture

Hi @nikunjkotecha,

Its working in your demo site. But not working in my drupal installation. Its a new drupal instance with just views module and your module installed. Will check once again!

And also there is a documentation https://www.drupal.org/node/1176080 demonstrating the views custom title.

Please have a look. Your module also require a additional custom module in case of any custom module not available for a custom callback function. We can use a Drupal Views hook function which will eliminate the use of your module.

nikunjkotecha’s picture

Hi Tushar,

Thanks for your time and going to the very depth. As mentioned in the project description on https://www.drupal.org/sandbox/nikunjkotecha/2693817, this module is to reduce the number of implementations of hook_views_pre_render() and increase performance. Imagine a site with 40 different view blocks and 20 odd modules to achieve this (I'm having this scenario and I'm sure many big sites will have this). I have used the same logic as mentioned in the reference link you have shared, in fact using this logic since many of my projects. But in my current one, designer had made the titles dynamic on most of the cases and I had to add many conditions + implement the hook in multiple modules. To reduce that and taking inspiration from views_access_callback and cpv modules, I decided to create a utility module and contribute it back to Drupal.

About requiring another custom module, yes we will need to have this + a custom module to define the callback function but in majority of the cases we will have at-least one custom module, correct? If it's just a small site, for sure we can avoid this module and have the one custom module to implement the hook.

Hope the logic and intention are clear now. Let me know if there is any more query and I'll be happy to add more detail to it.

Again, I really appreciate the efforts that you are spending in the community and ensuring that community keeps growing.

Thanks,
Nikunj

nikunjkotecha’s picture

Status: Needs work » Active
th_tushar’s picture

Status: Active » Reviewed & tested by the community

@nikunjkotecha,

The intention is not to block the application but to suggest the workarounds for the module. If you still want to promote it to full project, we can do that for you.

Changing the status to RTBC.

Thanks for your contribution again!!

nikunjkotecha’s picture

Thanks Tushar, that will be great. Also, did it work for you? Will it be possible to push the code in github or somewhere for me to check? I might have missed some scenario.

Again, this is a utility module and as mentioned in the description it is based on the workaround and enhances the usability of the workaround.

Few things to add on top of description:

  • With title callback defined in view, site builders and developers will be able to identify easily - from where the title is coming
  • This will reduce the need to implement a hook in every module and increase performance
  • A single function could be used multiple times. This can be done with hook too but it would mean more complex if conditions to check for the right view

Hope this helps.

PA robot’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
Multiple Applications
It appears that there have been multiple project applications opened under your username:

Project 1: https://www.drupal.org/node/2701025

Project 2: https://www.drupal.org/node/2693841

As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as 'closed(duplicate)', with only one application left open (chosen at random).

If you prefer that we proceed through this review process with a different application than the one which was left open, then feel free to close the 'open' application as a duplicate, and re-open one of the project applications which had been closed.

I'm a robot and this is an automated message from Project Applications Scraper.

nikunjkotecha’s picture

Priority: Normal » Major
Status: Closed (duplicate) » Reviewed & tested by the community

Updating it back to RTBC since this is having a PAReview: Single project promote and I'm hoping someone will be able to promote this soon.

PA robot’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
Multiple Applications
It appears that there have been multiple project applications opened under your username:

Project 1: https://www.drupal.org/node/2701025

Project 2: https://www.drupal.org/node/2693841

As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as 'closed(duplicate)', with only one application left open (chosen at random).

If you prefer that we proceed through this review process with a different application than the one which was left open, then feel free to close the 'open' application as a duplicate, and re-open one of the project applications which had been closed.

I'm a robot and this is an automated message from Project Applications Scraper.

avpaderno’s picture

Priority: Major » Normal
Issue tags: -PAreview: single application approval
Related issues: +#2907719: [D8] Permanent Cache Bin