Feel free to change this to the correct component, but I believe this would affect the theme system.

How about allowing blocks to have further capabilities than just being a set box of space. Authenticated users can already choose not to see a block, if you give them the capability to. However, they need to go to their account, edit it and then find the form group that will allow them to hide a block.

My ideas are to give the user a much ease of managing a customizable block. The two main features to accomplish this is...

1) Instead of having the block visibility editable on the Edit Account for the user. Give them a little maybe 8x8 icon of an 'X' in the subject of the block that will hide the block for the user and save it as if they went to their account and turned off the block. Remember, they will only have the 'X' on blocks you allow the user to hide.

2) This feature is like the first, in that you would have an icon that can change the block as a part of the block. However, this feature would have maybe a '-', that would minimize the content section of the block, but leave the subject with, instead of a '-', a '+' in place to allow the user to then maximize the content section back to full size. I would think that this feature could be done with jQuery's slideUp/Down functions. However, this feature would need some place to store, to keep the block minimized on future pages.

Let me know what other people's ideas are on these features. Thanks.

Comments

TapocoL’s picture

Status: Active » Needs work

Noone has replied, so I don't know if it is lack of interest. Or, if people had a hard time envisioning my ideas.

I have come up with a possibility of how you can add an 'X' to the top right portion of a block. Tell me if this would even be a possibility for Drupal 7. If there is no interest, then I guess there is no reason for me to look into how to try the minimize/maximize feature.

I added this function to Garland's template.php

function phptemplate_preprocess_block(&$vars) {
  global $user;
  if ($user->uid && db_result(db_query("SELECT bid FROM {blocks} WHERE theme = 'garland' AND custom = 1 AND module = '%s' AND delta = %d", $vars['block']->module, $vars['block']->delta))) {
    $rep = "<div class=\"custom\">". l("X", 'hide-block/'. $vars['block']->module .'/'. $vars['block']->delta, array('query' => drupal_get_destination())) ."</div>";
    if (!empty($vars['block']->subject)) {
      $vars['block']->subject = $rep . $vars['block']->subject;
    }
    else {
      $vars['block']->content = $rep . $vars['block']->content;
    }
  }
}

I added the following to Garland's style.css

.block .custom {
  float: right;
}

I added the following to a custom module I created just for this.

function mymodule_menu() {
  $items = array();
  
  $items['hide-block/%/%'] = array(
    'title' => 'Hide Block',
    'page callback' => 'mymodule_hide_block',
    'page arguments' => array(1, 2),
    'access callback' => 'user_access',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );
  
  return $items;
}

function mymodule_hide_block($module, $delta) {
  global $user;
  if ($user->uid) {
    if (user_save($user, array('block' => array($module => array($delta => 0))))) {
      drupal_set_message(t('Block has been hidden. If you would like to show a hidden block, edit your account and check the blocks you would like to have shown.'));
    }
  }
  else {
    drupal_set_message(t('You must be Logged-in to customize content'));
  }
  drupal_goto();
}
cburschka’s picture

It would be awesome if this were combined with some Ajax. Also, I don't remember what is the official place Drupal core gets GPL icons, but they definitely have a red X that would fit here.

(This also reminds me of the idea of dragging and dropping blocks between regions, but that would be an admin/build/blocks thing and go far beyond the scope of this feature request.)

TapocoL’s picture

Those other features would be awesome, but I don't really have the concept of what you would need to do with drupal. I am not that experienced with the potential security holes from AJAX. So, that is why I tackled this problem with just pages that redirect back to the same page. A good idea would be to save the info with AJAX, and use jQuery to make it disappear on the current page. Then, future page requests will load without the block at all since AJAX saved it. A little icon is what I had in mind for the 'X', but I just wanted to show how to accomplish this. Hopefully, someone will want to work with me on this, since I don't know how to work with CVS, yet. So, I cannot create patches for drupal.

cburschka’s picture

Don't let this fall under the radar, please. Done well, this would make the user interface as neat as Google News - removing, minimizing, resizing and dragging blocks.

drawk’s picture

Status: Needs work » Active

I agree that this is a cool idea, particularly if AJAXified. I wonder what sort of burden this would introduce to theme developers, though, to account for the shrinking (when minimized) or disappearing (when deleted) page elements. Seems like a good candidate for a contrib module to me, and after being out in the wild and refined for awhile, with a better assessment of the theming issues it might introduce then perhaps brought up as something to be introduced into core.

Changing to active as there is no patch here.

effulgentsia’s picture

Version: 7.x-dev » 8.x-dev
Component: theme system » block.module

These ideas sound great. I'd love to see them in action as a contrib module for D7. With D7's render API, hook_page_build(), and hook_page_alter(), you can even disable block.module and enable some BETTER_BLOCK.module, or you can have a module that improves on block.module while leaving it enabled. If a contrib module gets made and proves itself, we can then evaluate whether it makes sense to incorporate those ideas into the core block.module for D8.

jhedstrom’s picture

Version: 8.0.x-dev » 8.1.x-dev

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +stale-issue-cleanup

Thank you for sharing your idea for improving Drupal.

We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.

Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

Thanks!

smustgrave’s picture

Not sure I follow but wanted ot bump 1 more time before closing.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.