diff --git a/config/schema/ifthenelse.schema.yml b/config/schema/ifthenelse.schema.yml index dbef596..ffb5e58 100644 --- a/config/schema/ifthenelse.schema.yml +++ b/config/schema/ifthenelse.schema.yml @@ -1,17 +1,17 @@ -# Schema for the configuration files of the ifthenelse config entity. +# Schema for the configuration files of the ifthenelse config entity. -if_then_else.rule.*: - type: config_entity - label: 'If Then Else Rules' - mapping: - id: - type: string - label: 'ID' - label: - type: label - label: 'Label' - active: - type: boolean +if_then_else.config.*: + type: config_entity + label: 'If Then Else' + mapping: + id: + type: string + label: 'ID' + label: + type: label + label: 'Label' + active: + type: boolean label: 'Active' module: type: string diff --git a/if_then_else.install b/if_then_else.install index eee8242..ccdd849 100644 --- a/if_then_else.install +++ b/if_then_else.install @@ -36,3 +36,26 @@ function if_then_else_update_8002() { } } } + +/** + * Change config_prefix name form rule to config. + */ +function if_then_else_update_8003() { + $database = \Drupal::database(); + $query = $database->select('config', 'c'); + $query->fields('c'); + $query->condition('c.name', '%.rule.%', 'LIKE'); + $results = $query->execute(); + if (!empty($results)) { + foreach ($results as $result) { + $new_name = str_replace('.rule.', '.config.', $result->name); + // Update a record in config table. + \Drupal::database()->update('config') + ->condition('name', $result->name) + ->fields([ + 'name' => $new_name, + ]) + ->execute(); + } + } +} diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.current_theme_condition.yml b/modules/if_then_else_examples/config/install/if_then_else.config.current_theme_condition.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.current_theme_condition.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.current_theme_condition.yml diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.log_on_node_status_change.yml b/modules/if_then_else_examples/config/install/if_then_else.config.log_on_node_status_change.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.log_on_node_status_change.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.log_on_node_status_change.yml diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.log_on_node_update.yml b/modules/if_then_else_examples/config/install/if_then_else.config.log_on_node_update.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.log_on_node_update.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.log_on_node_update.yml diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.log_on_reset_link_request.yml b/modules/if_then_else_examples/config/install/if_then_else.config.log_on_reset_link_request.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.log_on_reset_link_request.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.log_on_reset_link_request.yml diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.log_when_node_is_deleted.yml b/modules/if_then_else_examples/config/install/if_then_else.config.log_when_node_is_deleted.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.log_when_node_is_deleted.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.log_when_node_is_deleted.yml diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.notify_via_email_that_cron_has_started.yml b/modules/if_then_else_examples/config/install/if_then_else.config.notify_via_email_that_cron_has_started.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.notify_via_email_that_cron_has_started.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.notify_via_email_that_cron_has_started.yml diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.page_redirect_to_different_pages_based_on_role.yml b/modules/if_then_else_examples/config/install/if_then_else.config.page_redirect_to_different_pages_based_on_role.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.page_redirect_to_different_pages_based_on_role.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.page_redirect_to_different_pages_based_on_role.yml diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.send_email_on_block_update.yml b/modules/if_then_else_examples/config/install/if_then_else.config.send_email_on_block_update.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.send_email_on_block_update.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.send_email_on_block_update.yml diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.send_email_on_node_update.yml b/modules/if_then_else_examples/config/install/if_then_else.config.send_email_on_node_update.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.send_email_on_node_update.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.send_email_on_node_update.yml diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.set_form_field_value_action.yml b/modules/if_then_else_examples/config/install/if_then_else.config.set_form_field_value_action.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.set_form_field_value_action.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.set_form_field_value_action.yml diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.show_message_on_a_certain_page.yml b/modules/if_then_else_examples/config/install/if_then_else.config.show_message_on_a_certain_page.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.show_message_on_a_certain_page.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.show_message_on_a_certain_page.yml diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.user_has_entity_field_access_condition.yml b/modules/if_then_else_examples/config/install/if_then_else.config.user_has_entity_field_access_condition.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.user_has_entity_field_access_condition.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.user_has_entity_field_access_condition.yml diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.user_is_blocked_condition.yml b/modules/if_then_else_examples/config/install/if_then_else.config.user_is_blocked_condition.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.user_is_blocked_condition.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.user_is_blocked_condition.yml diff --git a/modules/if_then_else_examples/config/install/if_then_else.rule.validate_form_on_submission.yml b/modules/if_then_else_examples/config/install/if_then_else.config.validate_form_on_submission.yml similarity index 100% rename from modules/if_then_else_examples/config/install/if_then_else.rule.validate_form_on_submission.yml rename to modules/if_then_else_examples/config/install/if_then_else.config.validate_form_on_submission.yml diff --git a/src/Entity/IfthenelseRule.php b/src/Entity/IfthenelseRule.php index fa7f258..a6da55b 100644 --- a/src/Entity/IfthenelseRule.php +++ b/src/Entity/IfthenelseRule.php @@ -10,7 +10,7 @@ use Drupal\Core\Config\Entity\ConfigEntityBase; * @ConfigEntityType( * id ="ifthenelserule", * label = @Translation("If Then Else"), - * config_prefix = "rule", + * config_prefix = "config", * handlers = { * "list_builder" = "Drupal\if_then_else\IfthenelseRuleListBuilder", * "form" = {