public function __call($tag, $args) { if (strpos($tag, 'set') !== 0) { return parent::__call($tag, $args); } $tag = strtolower(substr($tag, 3)); switch ($tag) { case 'card': case 'title': case 'description': case 'data1': case 'label1': case 'data2': case 'label2': return $this->addTag($tag, array_shift($args)); case 'site': case 'creator': case 'image': case 'player': if (count($args) < 2) { $args[] = []; } list($value, $options) = $args; return $this->addTag($tag, $value, $options); default: return parent::__call($tag, $args); } }
/** * {@inheritdoc} * * Add default input class to inputs generated using the * magic __call method * * @param string $method Method name / input type to make. * @param array $params Parameters for the method call * @return string Formatted input method. * @throws \Cake\Core\Exception\Exception When there are no params for the method call. */ public function __call($method, $params) { if (empty($params)) { throw new Error\Exception(sprintf('Missing field name for FormHelper::%s', $method)); } $class = ['class' => $this->config('input_class')]; if (isset($params[1])) { $params[1] += $class; } else { $params[1] = $class; } return parent::__call($method, $params); }
public function __call($tag, $args) { if (strpos($tag, 'set') !== 0) { return parent::__call($tag, $args); } $tag = strtolower(substr($tag, 3)); switch ($tag) { case 'name': case 'title': case 'description': case 'type': if (count($args) < 2) { $args[] = 'og'; } list($value, $namespace) = $args; return $this->addTag($namespace, $tag, $value); case 'image': case 'video': if (count($args) < 2) { $args[] = []; } if (count($args) < 3) { $args[] = 'og'; } list($value, $options, $namespace) = $args; return $this->addTag($namespace, $tag, $value, $options); default: return parent::__call($tag, $args); } }
/** * Handles dynamic template cloning * * You can get template clones by calling * ->makePhpBlock($source) where the template * name is 'PhpBlock' * * @param string $method * @param array $params * @return mixed */ public function __call($method, $params = NULL) { $match = preg_split('/make/', $method); if (count($match) === 2 && $match[0] === '') { return $this->makeNamed($match[1], $params); } parent::__call($method, $params); }