You are here

function _onlyone_delete_content_type_config in Allow a content type only once (Only One) 7

Delete the content type config variable.

Parameters

string $content_type: Content type machine name.

Return value

bool Return TRUE if the content type config was deleted or FALSE if not exists.

2 calls to _onlyone_delete_content_type_config()
drush_onlyone_disable in ./onlyone.drush.inc
Callback for the onlyone-disable command.
onlyone_node_type_delete in ./onlyone.module
Implements hook_node_type_delete().

File

./onlyone.helpers.inc, line 17
Helper functions.

Code

function _onlyone_delete_content_type_config($content_type) {

  // Getting the variables with the content types configuration.
  $onlyone_node_types = variable_get('onlyone_node_types');

  // Checking if the config exists.
  $index = array_search($content_type, $onlyone_node_types);
  if ($index !== FALSE) {

    // Deleting the value from the array.
    unset($onlyone_node_types[$index]);

    // Saving the values in the config.
    variable_set('onlyone_node_types', $onlyone_node_types);
    return TRUE;
  }
  return FALSE;
}