function _yoast_check_fields_access in Real-time SEO for Drupal 7
Actually we need access to all fields listed or selected.
Parameters
array $form:
Return value
bool
File
- ./
yoast_seo.module, line 183 - Primary hook implementations for Yoast SEO for Drupal module.
Code
function _yoast_check_fields_access(array $form) {
$return = array();
$bundle = $form['#bundle'];
$required_fields = array(
'yoast_seo',
'path',
'metatags',
);
$fields = variable_get('yoast_seo_body_fields_' . $bundle, array());
$default_fields = array_merge($required_fields, $fields);
if (isset($form['body'])) {
$return[] = $form['body']['#access'];
}
elseif (empty($fields)) {
// We don't have body and fields selected.
$return[] = FALSE;
}
foreach ($default_fields as $field) {
$return[] = !empty($form[$field]['#access']);
}
return array_sum($return) === count($return);
}