Skip to main content
added 618 characters in body
Source Link
August1914
  • 303
  • 1
  • 5
  • 16

What is the programmaticallyprogrammatic equivalent of block save?

From hook_save(), I've updated the "pages" attribute of a block, adding a path to the list.

db_update('block')
    ->fields(array('pages' => $pages))
    ->condition('delta', $delta)
    ->execute();

I've used the database API, (maybe that's the problem?) instead of the block API, because I'm under the impression there is no support in Drupal 7 for this. (hook_block_configure() I think is just for changes to default block configuration.)

The problem I'm having is that the update to the block pages attribute is not reflected, even after clearing caches, until I go to block edit form and click on Save.

IsThere's actually one thing in core's block module function block_admin_configure_submit, and that is to pass the event along: module_invoke($form_state['values']['module'], 'block_save', $form_state['values']['delta'], $form_state['values']);

I'm not sure how go about structure $form_state['values']. Is there a way to do this with the block API?

With regard to Context, we're already using it; we could accomplish the same thing by writing to path to exclude to the context['condition']['path'] attribute, (prefixing the path ~ to indicated "exclude"). This might be a better approach for us, but still would like to see the block code working.

What is the programmatically equivalent of block save?

From hook_save(), I've updated the "pages" attribute of a block, adding a path to the list.

db_update('block')
    ->fields(array('pages' => $pages))
    ->condition('delta', $delta)
    ->execute();

I've used the database API, (maybe that's the problem?) instead of the block API, because I'm under the impression there is no support in Drupal 7 for this. (hook_block_configure() I think is just for changes to default block configuration.)

The problem I'm having is that the update to the block pages attribute is not reflected, even after clearing caches, until I go to block edit form and click on Save.

Is there a way to do this with the block API?

What is the programmatic equivalent of block save?

From hook_save(), I've updated the "pages" attribute of a block, adding a path to the list.

db_update('block')
    ->fields(array('pages' => $pages))
    ->condition('delta', $delta)
    ->execute();

I've used the database API, (maybe that's the problem?) instead of the block API, because I'm under the impression there is no support in Drupal 7 for this. (hook_block_configure() I think is just for changes to default block configuration.)

The problem I'm having is that the update to the block pages attribute is not reflected, even after clearing caches, until I go to block edit form and click on Save.

There's actually one thing in core's block module function block_admin_configure_submit, and that is to pass the event along: module_invoke($form_state['values']['module'], 'block_save', $form_state['values']['delta'], $form_state['values']);

I'm not sure how go about structure $form_state['values']. Is there a way to do this with the block API?

With regard to Context, we're already using it; we could accomplish the same thing by writing to path to exclude to the context['condition']['path'] attribute, (prefixing the path ~ to indicated "exclude"). This might be a better approach for us, but still would like to see the block code working.

improved grammar and formatting
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

What is the Programmatic Equivelentprogrammatically equivalent of Block Saveblock save?

From hook_savehook_save(), I've updated the "pages" attribute of a block, adding a path to the list.

db_update('block')
    ->fields(array('pages' => $pages))
    ->condition('delta', $delta)
    ->execute();

I've used the database API, (maybe that's the problem?) instead of the block API, because I'm under the impression there is no support in the D7 block apiDrupal 7 for this. (hook_block_configurehook_block_configure() I think is just for changes to default block configuration).)

The problem I'm having is that the update to the block pages attribute is not reflected, even after clearing caches, until I go to block adminedit form and click [Save] on that blockSave.

Is there a way to do this with the block API, or, what do we do that is equivalent of clicking the [Save] button in block admin?

What is the Programmatic Equivelent of Block Save?

From hook_save, I've updated the "pages" attribute of a block, adding a path to the list.

db_update('block')
    ->fields(array('pages' => $pages))
    ->condition('delta', $delta)
    ->execute();

I've used the database API, (maybe that's the problem?) instead of the block API, because I'm under the impression there is no support in the D7 block api for this. (hook_block_configure I think is just for changes to default block configuration).

The problem I'm having is that the update to the block pages attribute is not reflected, even after clearing caches, until I go to block admin and click [Save] on that block.

Is there a way to do this with the block API, or, what do we do that is equivalent of clicking the [Save] button in block admin?

What is the programmatically equivalent of block save?

From hook_save(), I've updated the "pages" attribute of a block, adding a path to the list.

db_update('block')
    ->fields(array('pages' => $pages))
    ->condition('delta', $delta)
    ->execute();

I've used the database API, (maybe that's the problem?) instead of the block API, because I'm under the impression there is no support in Drupal 7 for this. (hook_block_configure() I think is just for changes to default block configuration.)

The problem I'm having is that the update to the block pages attribute is not reflected, even after clearing caches, until I go to block edit form and click on Save.

Is there a way to do this with the block API?

Source Link
August1914
  • 303
  • 1
  • 5
  • 16

What is the Programmatic Equivelent of Block Save?

From hook_save, I've updated the "pages" attribute of a block, adding a path to the list.

db_update('block')
    ->fields(array('pages' => $pages))
    ->condition('delta', $delta)
    ->execute();

I've used the database API, (maybe that's the problem?) instead of the block API, because I'm under the impression there is no support in the D7 block api for this. (hook_block_configure I think is just for changes to default block configuration).

The problem I'm having is that the update to the block pages attribute is not reflected, even after clearing caches, until I go to block admin and click [Save] on that block.

Is there a way to do this with the block API, or, what do we do that is equivalent of clicking the [Save] button in block admin?