Block visibility

For RestFul 1.x


You have a content type that you want to be display on specific pages. You want to use the same system as Drupal core block visibility.

Proposed resolution

Add a textarea field to your content type called visibility, with a machine name of field_block_visibility.

Visibility Block Textarea field

Create or add to your endpoint the following code:

CacheableDependencyInterface & friends

To make dealing with cacheability metadata (cache tags, cache contexts and max-age) easier, Drupal 8 has CacheableDependencyInterface.

Commerce Addressbook

Commerce Addressbook is a module that allows authenticated customers to reuse previously entered addresses during checkout. They can manage all entered addresses in their user panel (user/%user/addressbook).

Note that for data consistency reasons editing a previously entered address won't change it on previously made orders.

Cache max-age

Cache max-age = time dependencies

Cache max-age is analogous to HTTP's Cache-Control header's max-age directive


Cache max-age provides a declarative way to create time-dependent caches.

Adding Views to CINC

This is a stub page.

Reading field values in the database and applying it to CINC code

Step One- Look at how the field is set up in the database

Using the Devel module you can execute PHP code along the lines of this at

$a = CINC::init('Field')->machine_name('field_resource_access_rights')->read()->read_instance_for('node', 'resource');

Step Two - Apply changes in database to CINC code.

Step Three- Disable custom module and then re-enable custom module

*This is if you've defined content types in hook_enable()*


Subscribe with RSS Subscribe to RSS - Intermediate