As an IP Path Access administrator, I may have many access rules for a variety of use cases. It would be useful to have a description value assigned to each rule. This would help differentiate rules for the benefit of all site administrators.

In the admin form, I recommend that:

  1. The field be labeled Title
  2. The text input be positioned above the IP Address input
  3. The Title value appears to the left of PATH ALIAS in the table list of the IP access rules

Modules with similar functionality are: CSS Injector and Add to Head.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikebrooks created an issue. See original summary.

pallavi_sugandhi’s picture

Here is the attached patch for Text field to input a rule title. Please review

mikebrooks’s picture

Status: Active » Needs review
darrell_ulm’s picture

The patch in #2 looks reasonable https://www.drupal.org/node/2701395#comment-11048453
Someone other than the developer should test. I've been short on time lately.
Thank you.

mikebrooks’s picture

Status: Needs review » Needs work

Hi pallavi_sugandhi,

Thanks for your effort. The code to add the Title fields works well, but I did find two problems:

  1. When entering a Title longer than 46 characters, an error is thrown.
  2. The field description "An IP filter rule" does not clearly indicate what the user should enter into the field. It also references "IP filter", which is not the name of the module.

In ip_path_access_schema(), you set the title as:

   'title' => array(
        'description' => 'An IP filter rule',
        'type' => 'varchar',
        'length' => 46,
        'not null' => TRUE,
        'default' => '',
      ),

Following the method used by the popular CSS Injector module, I suggest changing it to:

   'title' => array(
        'description' => 'The descriptive title of the IP Path Access rule',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),

In the form, the text input should have a maxlength attribute. I suggest a maxlength="128", again following the CSS Injector example.

pallavi_sugandhi’s picture

Status: Needs work » Needs review
FileSize
2.1 KB

I have modified the patch file.

mikebrooks’s picture

Assigned: Unassigned » darrell_ulm
Status: Needs review » Reviewed & tested by the community

Patch looks good to me. Thanks pallavi_sugandhi.

darrell_ulm, I have assigned the issue to you for approval. If the patch meets your approval, please assign to Nishad who can complete the merge into the Dev branch and close the issue.

darrell_ulm’s picture

Code looks good to add the title for a rule, go ahead.

darrell_ulm’s picture

Assigned: darrell_ulm » bhide.nishad

bhide.nishad’s picture

Assigned: bhide.nishad » Unassigned
Status: Reviewed & tested by the community » Fixed

Patch has been applied in 7.x-1.x.
Thanks for the patch @Pallavi.

bhide.nishad’s picture

Status: Fixed » Closed (fixed)