Tribe__Admin__Notices::__call( string $name, array $arguments )
Allows a Magic to remove the Requirement of creating a callback
Contents
Parameters
- $name
-
(string) (Required) Name of the method used to create the slug of the notice.
- $arguments
-
(array) (Required) Which arguments were used, normally empty.
Return
(string)
Source
File: src/Tribe/Admin/Notices.php
public function __call( $name, $arguments ) {
// Transform from Method name to Notice number
$slug = preg_replace( '/render_/', '', $name, 1 );
if ( ! $this->exists( $slug ) ) {
return false;
}
$notice = $this->get( $slug );
if (
empty( $notice->active_callback )
|| (
is_callable( $notice->active_callback )
&& true == call_user_func( $notice->active_callback )
)
) {
$content = $notice->content;
$wrap = isset( $notice->wrap ) ? $notice->wrap : false;
if ( is_callable( $content ) ) {
$content = call_user_func_array( $content, array( $notice ) );
}
// Return the rendered HTML
return $this->render( $slug, $content, false, $wrap );
}
return false;
}
Changelog
| Version | Description |
|---|---|
| 4.3 | Introduced. |