# `MishkaCmsMigration.Targets.CmsSetting`
[🔗](https://github.com/mishka-group/mishka_cms_migration/blob/v0.0.1/lib/mishka_cms_migration/targets/cms_setting.ex#L5)

The `"setting"` items of a source, the site's own name and pictures, written to the run's site's
settings (`MishkaCmsCore.Runtime.Setting`) through the `:set` the Settings page's save runs
(`MishkaCmsCore.Settings.put_as/4`), as the admin who pressed Import: the admin needs what
writing the setting takes (`MishkaCmsCore.Settings.write_permission/1`,
`admin:dashboard:setting` for these), and the core's own rules decide the rest.

An item is one setting, by its source id:

  * `"title"` — the site's name, its `site.title`;
  * `"logo"` — its logo, `site.logo`, and `"icon"` — its icon, `site.favicon`: the item's
    `"value"` is the source id of a file, and the setting is the Media address of the file the
    same run, or an earlier one, wrote for it (`MishkaCmsMigration.Targets.CmsMedia.addresses/2`).
    An import whose file was not written, such as an SVG, skips it as `"file_missing"`; a dry
    run, which writes no file, does not;
  * `"tagline"` — the CMS has no setting for a tagline, so it is skipped as `"no_setting"`, in
    the dry run too, and so is any other.

## The site's own

A setting the site already holds a value of its own for is never written over on the import's
own say: read before anything is written, in the dry run too (`existing/2`), from the core's
settings cache, so with no query, it waits for an admin's decision as `"site_has_own"`
(`MishkaCmsMigration.MigrationItem`'s Decide…). Keep the site's own skips it as
`"site_own_kept"`; Use the WordPress one writes it over through the same `:set`, and the report
says so (`note/2`, `"site_own_replaced"`). A value the site takes from the installation's global
settings, or an empty one, is not the site's own, and is written over by the site's own.

A re-run is held to the rules every target is: a setting the source did not change is
`"unchanged"`, and one an admin changed or removed in the CMS since is kept as the admin left it
(`MishkaCmsMigration.Workers.Helpers.Decision`). One the source changed is written again through
the same `:set`, which writes over the site's row and keeps its id.

# `error_return`

```elixir
@type error_return() ::
  {:error, [%{action: atom(), field: atom(), message: String.t()}]}
```

# `okey_return`

```elixir
@type okey_return() :: {:ok, struct() | map() | module() | [any()]}
```

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `config`

```elixir
@spec config() :: keyword()
```

# `config`

```elixir
@spec config(atom()) :: any()
```

# `enable`

```elixir
@spec enable() :: okey_return() | error_return()
```

# `get`

```elixir
@spec get() :: keyword()
```

# `health_check`

```elixir
@spec health_check() :: :ok | {:degraded, term()} | {:error, term()}
```

Optional. See `c:MishkaInstaller.Event.Hook.health_check/0`. Override to report health.

# `on_dependency_error`

```elixir
@spec on_dependency_error(term()) :: term()
```

Optional. See `c:MishkaInstaller.Event.Hook.on_dependency_error/1`. Override to react.

# `register`

```elixir
@spec register() :: okey_return() | error_return()
```

# `restart`

```elixir
@spec restart() :: okey_return() | error_return()
```

# `start`

```elixir
@spec start() :: okey_return() | error_return()
```

# `start_link`

# `stop`

```elixir
@spec stop() :: okey_return() | error_return()
```

# `unregister`

```elixir
@spec unregister() :: okey_return() | error_return()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
