texts:
Im attempting to wrap my secondary links in an if statment that looks at the URL and only displayes them if URL is work/*.

The secondary links are only related to work but show on every page so i am trying to emove on any path that is not work/*. The secondary links are within my page.tpl

Ive been tryin with this but no joy.

 <?php  if ($the_url = explode('/', urldecode(request_url('work')))):?>

<?php if (!empty($secondary_links)){ print theme('links', $secondary_links, array('id' => 'secondary', 'class' => 'links sub-menu')); } ?>

<?php endif; ?>

Any help would be much appretiated.

Thank you


texts: Upload and get images in custom module with custom block form

texts:
I need some help
I need create slider on the front page with custom block.
I create custom module, create custom block and form.
How i can get images after upload in form for use in twig-template??

For example i create some block with input[type]=textfield, and use this values in twig-template. How can i use images??

its my code for 'textfield'

<?php

namespace Drupal\dot\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Core\Form\FormStateInterface;

/**
 * Provides a 'SocialLinksBlock' block.
 *
 * @Block(
 *   id = "social_links_block",
 *   admin_label = @Translation("Social Links Block"),
 * )
 */

class SocialLinksBlock extends BlockBase implements BlockPluginInterface {
    /**
     * {@inheritdoc}
     */
    public function blockForm($form, FormStateInterface $form_state) {
        $form = parent::blockForm($form, $form_state);
        // Retrieve existing configuration for this block.
        $config = $this->getConfiguration();
        // Add a form field to the existing block configuration form.
        $form['youtube'] = array(
            '#type' => 'textfield',
            '#title' => t('Youtube link:'),
        );
        $form['google'] = array(
            '#type' => 'textfield',
            '#title' => t('Google link:'),
        );
        $form['twitter'] = array(
            '#type' => 'textfield',
            '#title'=> t('Twitter link:'),
        );
        $form['facebook'] = array(
            '#type' => 'textfield',
            '#title'=> t('Facebook link:'),
        );
        return $form;
    }

    public function blockSubmit($form, FormStateInterface $form_state) {
        // Save our custom settings when the form is submitted.
        $this->setConfigurationValue('youtube', $form_state->getValue('youtube'));
        $this->setConfigurationValue('google', $form_state->getValue('google'));
        $this->setConfigurationValue('twitter', $form_state->getValue('twitter'));
        $this->setConfigurationValue('facebook', $form_state->getValue('facebook'));
    }
    /**
     * {@inheritdoc}
     */
    public function build() {
        $config = $this->getConfiguration();
        $youtube = isset($config['youtube']) ? $config['youtube'] : '';
        $google = isset($config['google']) ? $config['google'] : '';
        $twitter = isset($config['twitter']) ? $config['twitter'] : '';
        $facebook = isset($config['facebook']) ? $config['facebook'] : '';

        return array(
            '#theme' => 'block--sociallinksblock',
            '#youtube' => $youtube,
            '#google' => $google,
            '#twitter' => $twitter,
            '#facebook' => $facebook,
        );
    }
}


texts: How to make a reference to an entity using the uuid of the entity?

texts:
Is there any way to make a reference to an entity (using refereces, entity reference or relation) using the uuid of the entity?

I'm using features and uuid_features to export the content but refereces are being exported using the id and not the uuid.


texts:
What is the recommended way to add a "clearfix" class to a div.views-row?

Note that I dont want to add the clearfix to all views, just a specific view.

Is this best done with a template override, or is there a mystical alter hook that will let me add in what I need in my template.php without having to override and thus maintain an entire views template file, just to add a class.


texts: Form API merge persistent variables into array?

texts:
I am trying to merge multiple persistent variables from a Drupal form into one array, which is then the sole variable set in the form using variable_get('sole_array_var', $default).

The problem is that I cannot seem to get the form to equate the $form_state['values] array to the 'sole_array_var' above.

Is there any precedent for not using multiple persistent variables in forms, but rather using one which is saved as an array.  I hope this makes sense, here's an example:

function module_settings($form, &$form_state) {
  $default = array(
    'themes' => 0,
    'buttons' => 1,
    'content' => 0,
    'autotext' => 0,
    'autoexpand' => 0,
    'switch' => 0,
    );
$form_settings = array_merge($default, variable_get('mymodules_settings', $default));
$form['mymodules_settings'] = array(
  '#tree' => TRUE,
  '#type' => 'fieldset',
  '#title' => t('My Module - Options & Settings'),
  '#collapsible' => FALSE,
);
// Add theme selection.
$form['mymodules_settings']['themes'] = array(
  '#type' => 'fieldset',
  '#title' => t('Theme'),
  '#collapsible' => TRUE,
  '#collapsed' => TRUE,
);
// Themes.
$form['mymodules_settings']['themes']['theme'] = array(
  '#type' => 'select',
  '#title' => t('My Module Theme'),
  '#default_value' => $form_settings['themes']['theme'],
  '#options' => $moduleoptions,
  '#description' => t('Select ....'),
);
// Refine chosen theme.
$form['mymodules_settings']['themes']['pattern'] = array(
  '#type' => 'checkbox',
  '#title' => t('Buttons/Arrows'),
  '#default_value' => $form_settings['themes']['pattern'],
  '#description' => t('Turn patterns on or off.'),
);

   return system_settings_form($form);
}


texts:
To use already existing image, I choose 'Media File Selector' Widget.
But, it gives me blank page like this when I click on 'Library' to choose already existing image in Drupal-7.

Version of the Media:
1) Media: YouTube
(media_youtube) 7.x-2.0-rc4

2) Media
(media) 7.x-1.4

In Media browser settings, Allowed file extensions are
(jpg jpeg gif png txt doc docx xls xlsx pdf ppt pptx pps ppsx odt ods odp mp3 mov m4v mp4 mpeg avi ogg oga ogv wmv ico)

Thanks!


texts: Bad error handling of .pdf files against all other file types when a file exceeds the maximum file size

texts:
I have a file field with the following allowed file extensions: txt, pdf, doc, docx, zip

The Maximum upload size is set via my php.ini  and it is upload_max_filesize = 2M

1. While I'm trying to upload a file that exceeds the maximum file size I get the following error as expected:

Any other file (with file_size < 2MB) uploaded from before (form submit) remains as is and I have the ability to re-upload a new file.

I observed that this is working good with all types of files except one, the .pdf type.

2. When I upload a file.pdf with file_size > 2MB I get this error:

All previous uploaded files (if any - with file_size < 2MB) are disappearing (*) and I don't have the ability to re-upload a new file except if I refresh the page anew.

The expected behavior would was this (1.)  :a warning message telling me about the size of the file and an option to re-upload a file without having to refresh the page anew. Instead I get (2.) an error message and no possibility to re-upload any files without refreshing the page.

Note that this is the case only for .pdf files!

Debugging info:

(*) I found that the responsible function for this behavior is this: file_ajax_upload

Its if() statement evaluates to true

if (empty($_POST['form_build_id']) || $form_build_id != $_POST['form_build_id']) {
    // Invalid request.
    drupal_set_message(t('An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (@size) that this server supports.', array('@size' => format_size(file_upload_max_size()))), 'error');
    $commands = array();
    $commands[] = ajax_command_replace(NULL, theme('status_messages'));
    return array('#type' => 'ajax', '#commands' => $commands);
  }

and the the form's markup is being replaced nicely!

Another more interesting thing that I found through the chrome's console, and I believe that it points to the correct direction, is this:

I tried the following code but it didn't work:

$form['field_name']['#attached'] = array(
  'drupal_add_http_header' => array(
  array('Content-Type', 'text/html; charset=utf-8')
);

Do you think that this is related to a configuration related to my environment or a bug  ? How can I solve this issue ? Should I go after the MIME type somehow ?


texts:
I am using Views 7.3.8 with Drupal 7.30. I use this combination for a total of 5 individual sites.

On 1 of my sites when I go into any view>>> edit page and try to click on field/title or any link on the edit page, the overlay pops up with a blank screen and just sits there empty.

I have tried disabling along with several other things short of uninstall/reinstall.

Any ideas?


texts: How do I translate the tab menu of a view?

texts: I cannot translate the tabs menu shown in a view. Does anyone know how to do it?


texts:
I deployed a Drupal 8 website, on a hosting service with cPanel, with domain mydomain.com.

If I set this email address on the user profile: john.smith@example.com, that is an email address with a domain different from mydomain.com, then I go to:

mydomain.com/user/password

and I click to "Send" trying to receive the "reset password" email, it give me the error below and I don't receive the email:

  Unable to send e-mail. Contact the site administrator if the problem
  persists.

Same problem on contact forms.

If I set an email address within my domain, for example john.smith@mydomain.com, all works and the email is correctly sent.

Any idea why this is happening and how to solve this problem?

NOTE

I tried to create this php script inside the server in order to check if there is some issue on the server configuration:

<?php

$to = "john.smith@example.com";
$subject = "Test mail";
$message = "This is a test message.";

$headers = [];

$headers[] = "From: noreply@example.com";
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=UTF-8; format=flowed; delsp=yes";
$headers[] = "Content-Transfer-Encoding: 8Bit";
$headers[] = "X-Mailer: Drupal";
$headers[] = "Reply-To: noreply@example.com";

$res = mail($to, $subject, $message, implode("\n", $headers));

echo "Mail Sent.
\n";
echo "Res: " . $res . "
\n";

When I run this script it correctly works and sends the email, either if the $to property is from my domain or if it is from an external domain.

So I excluded it is a server configuration issue.


texts: Changing a menu's target nodes for each page

texts:
For a Drupal 7 website, I need to have 2 types of menus: 1 menu with a list of countries, each menu entry pointing to a given node. For each country page, I need to display a 'characteristics' menu, with fixed items (e.g. population, incomes), but (of course) the targeted nodes have to be changed in function of the current country. (Clicking on the 'characteristics' menu entries opens a page which is different for each country.)

Is there a module for that in Drupal 7, or a way to do that programmatically?


texts:
I am upgrading my website from Drupal 6 to Drupal 7.  In the Views module, when I attempt to save a view I now get the following error:

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column
'human_name' in 'field list': UPDATE {views_view} SET
name=:db_update_placeholder_0, description=:db_update_placeholder_1,
tag=:db_update_placeholder_2, base_table=:db_update_placeholder_3,
human_name=:db_update_placeholder_4, core=:db_update_placeholder_5
WHERE (vid = :db_condition_placeholder_0) ; Array (
[:db_update_placeholder_0] => Last_update [:db_update_placeholder_1]
=> last update [:db_update_placeholder_2] => [:db_update_placeholder_3] => node [:db_update_placeholder_4] =>
[:db_update_placeholder_5] => 0 [:db_condition_placeholder_0] => 11 )
in views_db_object->save_row() (line 2092 of
/home/yektafil/domains/dl.yektafile.info/public_html/sites/all/modules/views/includes/view.inc).

Does anyone know what's causing this?


texts: Can contextual drop-down menu replace menu tabs?

texts:
When I am viewing stuff I have admin rights to the tabbed menu with stuff like 'View | Edit | Outline | etc ' takes up too much space.

Is there a way to switch drop down menus similar to those used for blocks?


texts: Add an boolean attribute to a text field?

texts:
I need to add a boolean attribute in the form of a check-box to a ordinary multivalued text field attached to a node. In this case, the text field will be used to list arguments for functions, which can either be required or not-required. So, in a node-edit form, I envision it to look something like the screen below. What's the best way to go about this?

Edit: adding links to suggested options, and also some that I found while checking these out:

field collection - https://drupal.org/project/field_collection
field collection table - https://drupal.org/project/field_collection_table
double field - https://drupal.org/project/double_field
tablefield - https://drupal.org/project/tablefield
multifield - https://drupal.org/project/multifield (dev)


texts: Passing data from outer preprocess to inner template

texts:
I have two templates:
- a child that is printing each item in a list;
- and a parent that calls it
there is also an intermediate Field template that is not involved.

The parent has preprocess access to node field data that each child (node teaser) call needs to use. The child is printing items in a multivalue entity reference field.

How can the child get the data from the parent felds so it can print the right html?

Edit: Just in case it's not clear, the situation is:

paragraph_entity        <== preprocess hook can see field_settingsN which change how "B" and "A" render (e.g. add/change attrs, class).
  -> field_settings_1
  -> field_settings_2
  -> field_references   <== have a defined template "B"
    -> 1.. entity refs to nodes
      -> node           <== have a defined (teaser) template "A"


texts: How to force openid login from a single provider in Drupal 7?

texts:
So with the current Drupal 7's OpenID module, one must click on the "OpenID" on the main page, which the user then enter the url of the OpenID provider to link up to. Assuming I know exactly what provider I want to use (my university's), there some way I can make it such that as soon as a user visits the homepage, or any part of my drupal site, the first thing it does is authenticates with that specific provider url before it even shows the page?

The reason being is I want people within the university network to be able to go to the site and automatically see who they are without having them perform that extra step of clicking on an "openid" button. Much like a single-sign-on solution.


texts: Override Domain-Restricted Content in a View

texts:
I have a site running Domain Access, which is restricting content to the domain it was created on. Using Domain Views, I've created two types of views:

views displaying content for the current domain.
views displaying content for all domains.

However, #2 displays as #1 for anyone without the "Administer Content" permission. How can I set this up so anonymous users on one.mysite.com can see linked content on two.mysite.com ?

In addition, when they click links to other domains, I want them to be transfered to the other domain to view the content.

How can this be done?


texts: How can I disable caching for the front page, programmatically?


texts:
Is anyone using manualcrop https://drupal.org/project/manualcrop?
It works fine in Firefox but doesn't work in Chrome.

Using Drupal 7.

Thanks!


texts: Views Slideshow Contextual Filter, Show Images From Same Node

texts:
In a Content Type A I have added a image field with a value to add unlimited images.

Created nodes of Content Type A and adding multiple images to the field in all nodes of that content type.

Through Views Slideshow I have created a slideshow which is displaying all images added through that field.

Created a block display and configure that block to appear on nodes of the Content Type A.

Slide show is displaying all images added in different nodes of that content type.

I want views slideshow to display the images in context to the node it is appearing on. Means only display the images which are added on that particular node.

I think this could be achieved through contextual filters, but not sure how to do this.


texts: I accidentally removed the core blocks from content region

texts:
I accidentally remove the core/system blocks that normally sit under the content region and now I am not able to access any of the administration page.

If I visit my site/user/login, or register, etc, it shows me everything as per the markup I created

Is there a way I can re-add those blocks to the content region without being logged in?
Any database query, drush command or drupal console?


texts: Does the Data Export module support exposed filters?

texts:
I am looking to use the Data Export module to export data to CSV files. However, I need the users to be able to filter the data first with exposed filters and then download the filtered results.

From what I can see, the module seems to be an all or nothing module.

Does anyone know if it is configurable?


texts: I have Drupal Commerce, and it sends confirmation emails after product is sold. In those emails are tokens. I have token [commerce-order:created] and I'm interested if is there any conveniant way to change a formatting of that date.


texts: How to display the default user picture programatically?

texts:
I'd like to print a user's image in a View's template file. If the user hasn't set an image yet, the default user picture (set to public://pictures/default.jpg at Configuration > People > Account settings) should be rendered.

I used the following code:

<?php $account = user_load($user->uid); ?>
<?php if (isset($account->picture->uri)) {
          $path = $account->picture->uri; }
      else {$path = "public://pictures/default.jpg"; } ?>
<?php $array = array('style_name' => 'picture',
                     'path' => $path,
                     'alt' => 'Picture'); ?>

<?php print theme('image_style', $array); ?>

That works perfectly, but I don't really like the isset approach, because it makes me think that it was redundant to specify the default image path in the configurations. Is there another method that uses the default path automatically?


texts: Taxonomy Term URL based on Panel Contextual filter path

texts:
I run a Drupal 7 website that is a multiple resort guide.

I have set up a panel page based on 2 contextual filters.

www.domain.com/resort/%1/things-to-do/%2

%1 = Taxonomy Term [Vocabulary:Resort] (term names: Magaluf, Malia, Zante, Ibiza etc)

%2 = Taxonomy Term [Vocabulary:Attraction_Categories] (term names: Boat Parties, Stag Parties)

I have a node [nod:type:Attraction]. When creating a new 'Attraction' you tag this node with the corresponding tags (Resort/Attraction Category).

For eg;

domain.com/resorts/ibiza/things-to-do/boat-parties/[node:type:Attraction]
domain.com/resorts/malia/things-to-do/stag-parties/[node:type:Attraction]
domain.com/resorts/magaluf/things-to-do/beach-parties/[node:type:Attraction]

The panel display's all attraction nodes in teaser displays based on the contextual filter from the URL.

For eg: domain.com/resorts/magaluf/things-to-do/beach-parties/ will display all the [node:type:attraction]'s of all the beach-parties in magaluf

What I am trying to do:

I would like to create a view on the parent page of the attraction categories panel page for each particular resort (eg Ibiza, domain.com/resorts/ibiza/things-to-do)

This view will then display links of all the terms of the vocabulary:attraction-categories. Each taxonomy term will link from that specific resort it is displayed in.

For example, selecting the term Beach Parties on page www.domain.com/resorts/zante/things-to-do would take you to domain.com/resorts/zante/things-to-do/beach-parties

I have been playing around with a view to display all taxonomy terms of the vocabulary - Attraction Categories then re-writing the output of the taxonomy temr URL to resorts/%1/things-to-do/[term:name] but no luck. :-(

Please help as I am now running out of ideas.

Thank you in advanced.


texts:
Lots of times here I've been told that using views custom php fields, filters or others is a bad practice, because putting php in the sql is dangerous.

My question is, if you only call to a function, that you defined in a module, is it still as bad?

Sometimes, especially for Views, making a custom handler, or, other example, a custom token, can be really heavy.
What are the risks if I make a custom field that only calls a function? Is it as dangerous and "forbidden"?


texts: Import a Batch of Nodes via Feeds Module on Varnish environment

texts:
I have some problems on import node via Feeds module.

I already set feeds importer and it worked fine on the dev site and local site.

But It have some problems on the site with varnish already installed.

Either Batch process not working or have some response timeout or have multiple the some node import.

I really don't know how to fix that, I can't turn off the varnish because high traffic will kill my server immediately.

Does anybody have solution?


texts: Drupal 7 GetLocations field geocoding off?

texts:
I am using this: https://www.drupal.org/project/getlocations

The problem is, when I add a geolocations field to a content type, and type in, for example:

Boulders Beach, Kleintuin Road, Cape Town, Western Cape

If I see maps.google.co.za, I get:

-34.197116,18.451423

But the geolocations field gives me:

-34.1964859,18.45004849999998

In this specific case the difference isn't that big, but I've had a few cases where it's completely wrong. For example:

Spier Wine Farm, Stellenbosch

Correct google result:

-33.973474,18.782544

what I get on the geolocations field:

-33.9805299, 18.773583700000017

It looks like they are off by 0.007, 0.009.

Any ideas why this could be happening?


texts: How can I save multiple images to one image field programtically?

texts:
I have an image field that I am trying to save multiple images to.  There is one field but when I set up the array, only the first image fid is saved.

$i = 0;
foreach ($photos as $photo) {
// make sure we actually retrived this particular image
if ($photo['Success'] == TRUE) {
    // setup the filename and filepath, then write the file to disk
    $filename = "{$id}-{$number}.jpg";
    $filepath = "public://drealty_img/{$filename}";

    // Create image object
    $file = file_save_data($photo['Data'], $filepath, FILE_EXISTS_REPLACE);

    // add this image to the content entity
    $content->images = array(
        'und' => array(
            $i => array(
                'fid' => $file->fid,
            ),
        ),
    );
} // endif $photo['Sucess']
$i++;
} // endfor $photos

Am I saving the image field incorrectly?  Or is there something that needs to be set up to allow for multiple images to be saved?


texts: Prevent password reset urls from being redirected at login

texts:
I'm using the following code to redirect users at login (Drupal 6):

function hook_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
    case 'login':
        if (_cns_user($account)) {
            unset($_GET['destination']);
            unset($_REQUEST['destination']);
            drupal_goto('user/'. $account->uid .'/training', NULL, 'steps');
        }
        break;
    }
}

The problem I have is that this doesn't allow for users to be redirected to the password reset page (user/reset/) when needed. Is there a way to prevent the reset url from being redirected? Thanks in advance.


texts: How Do I Create a User Role that Can Only CRUD a Single Content-type?

texts:
OK, so I know how to create roles and messed around with the People->Permissions->Roles screen.  My goal is to create a single user role that will have only one function -- to administer the calendar events for the client site.

The first thing I did was to create a view to act as the overview of the available content.  I added in the Login Destinations module and set it to send the user directly to the Events content overview view.

I checked the following role permissions at the Node level as:

Access the content overview page
View published content
View own unpublished content
View content revisions
Revert content revisions
Delete content revisions

And at the content-type node itself:

Calendar Event: Create new content
Calendar Event: Edit own content
Calendar Event: Edit any content
Calendar Event: Delete own content
Calendar Event: Delete any content

So, when I log in as my event administrating user, I am redirected to the overview page, as expected.  But when I click on the link to the node, I get this:

"You are not authorized to access this page."

So, my question is two-fold.  1) Is there a better way (read: built-in) to implement the "overview" of the content that I'm not aware of? 2) Am I using the People->Permissions->Roles as designed?  If not, what am I doing wrong?

Thanks in advance,

Scott.


texts: How to update custom user field on form submit

texts:
I want to create a basic page that has only one of my custom user account fields listed, and available to edit.

For example, I have a custom user account field: field_companyname

Rather then directing the user to go to www.example.com/?q=user/1/edit,
I want the user to go to a different page (i.e www.example.com/node/5).
On this page, there should only be a single text input field, and a submit button to save the new data to the user account.

I'm pretty sure I need to implement user_save(), but I just don't know where to go from here.

// load user object
$existingUser = user_load('USERID');

// update some user property
$existingUser->some_property = 'foo';

// save existing user
user_save((object) array('uid' => $existingUser->uid), (array) $existingUser);

Any help or pointers would be much appreciated. Thanks for looking!

EDIT: I was able to load the entire user account edit form onto a node using the following code:

<?php
  module_load_include('pages.inc', 'user', 'user');
  global $user;
  $account = user_load($user->uid);
  $output = drupal_render(drupal_get_form('user_profile_form', $account));
  return $output;
?>

However, I still cannot figure out how to display ONLY my single custom field. Any help is greatly appreciated.

EDIT #2: I used CSS to hide the other fields that I did not want to display. Seems like there should be a better way to do this. But I guess this will work for now, unless anyone else can chime in :-)

Thanks again for looking.


texts: How to set type="email" attribute on a Drupal form textfield

texts:
I'm doing some mobile forms with Drupal and have an email address textfield that currently has type="text" in the resulting HTML. I'd like this to be type="email" instead so that iOS shows a more useful keyboard when entering the email address.

I tried adding:

"#attributes" => array("type" => "email")

to my field but it seems to just get ignored by Drupal. Is there a correct and/or supported way to achieve this?


texts: Replacing core forum pages with views throws a warning

texts:
I set up views for forum/% paths to replace the core forum pages, and it works fine except I get this error:

Notice: Trying to get property of non-object in forum_menu_local_tasks_alter()
(line 169 of opt/jenkins/blahblah/modules/forum/forum.module).

Line 169 is the last line in this code block:

/**
 * Implements hook_menu_local_tasks_alter().
 */
function forum_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  global $user;

  // Add action link to 'node/add/forum' on 'forum' sub-pages.
  if ($root_path == 'forum' || $root_path == 'forum/%') {
    $tid = (isset($router_item['page_arguments'][0]) ? $router_item['page_arguments'][0]->tid : 0);

This is failing because $router_item['page_arguments'][0] is defined but it's a string, not an object.

So what are my options here?

I don't want to hack the forum module to change that line
I don't want to change the path of my views to something besides forum/%
So I think I need to figure out how to unset $router_item['page_arguments'][0] so that that conditional will short circuit? Or is there another way?


texts: How to add data from one Drupal site to other?

texts:
Help me solve this scenario,

Assumptions:

Two users user1 and user2 are using their own copy of Drupal site - site1 and site2 on their respective machines.
They use same set of contributed modules (possibly with different configuration of the modules).
Both users add about 300 pages each to the sites.

Now, it is decided that the organization will use the site of user2 and migrate it to the production server. The organization also wants the pages created by user1 to be added to the site created by user2. How can this be done without changing the configuration of the site?

I did use the Backup and Migrate module to migrate the site site2 of user2 to the production server. Now, I am having difficulty in adding the content of site1 created by user1 to the production site; because if I use Backup and Migrate module again it will overwrite the existing pages from the site. It will also change the settings of the modules stored in the database. It is because, the nodes (pages) on site2 and site1 will have nids starting from 1 and auto-incrementing in the nodes table. So, doing a backup and migrate procedure will replace nid=1 from site2 with nid=1 from site1.

Is there a way so that I could append nid from the old database to new?

What other options do I have?


texts: Custom View : display fields linked to file upload field?

texts:
I'm trying to accomplish this simple thing but cannot find a way to do it.
If someone could guide me a little bit because I'm going inside deep crazy methods and classes, but I'm sure I'm going the wrong way and there's a simple way to accomplish this :)

I have a view block, that displays these fields :

Content: Title (the title)
Content: Image (Image)
Content: Pdf (File Upload)

So, the title, the image and the file upload are displayed.

I would like to output something like this :

<a href="__link_to_my_pdf__">
    __Title__
    __Image__
</a>

Is there a way to do this through the view management ?
If not, what could be the right way ? Twig ? Preprocess ? Module ?

I tried through a views-view--myviewblock.html.twig to get the variables inside {{rows}}, but spent 4 hours and failed.

Thanks in advance.


texts: Ubercart Line item tax not displayed first time

texts:
Im adding a line item to ubercart order at checkout validation. When at the review page I can see the line item but its not used in the tax calculation. But when i go to the review page for the second time it is.

Who can help me?


texts:
In the admin of a certain Content type (node/31/edit), I Added a select list field field_hero with two key|value's:

carousel|Carousel
video|Video

when the site editor select carousel, I want to display/show the field_carousel (an Entity reference revisions field, Paragraph type, where the site editor can create and insert slides for the carousel)
when the site editor select video, I want to display/show the field_video (a media field, where the site editor can insert a Youtube video)

So long story short. For the Hero section (header) the site editor is able to insert a Carousel or a Video.

Update

I try using Form API #states. I tried the following:

function my_theme_form_alter(&$form, FormStateInterface $form_state, $form_id) {
if($form['#id'] == 'node-landing-page-edit-form') {

    $form['field_carousel'] = array(
      '#states' => array(
        // Only show this field when the 'field_hero' checkbox value is carousel.
        'visible' => array(
          array(
            ':input[name="field_hero"]' => array('value' => 'carousel'),
          ),
        ),
      ),
    );
  }
}

The paragraph field_carousel is of Type Entity reference revisions. Above is not working yet. How do I hide my paragraph field on the edit page using states?


texts: Create send user private message link in a node template content type

texts:
How do you print the private message link in a node template please?

This what I've tried

hide($content['field_privatemsg']);

print render($content['field_privatemsg']);

Many thanks for your help


texts: How to configure view filter to search on the basis of two conditions

texts:
I have created a view for users which is having filters: Username,Email,Company and Country. I am also using views bulk operation with these filters.

I can search any record on the basis of above fields but the problem is to search the record on two conditions.

For Example: I want to search on the basis of email: I want the record of those users whose accounts are neither in gmail nor in yahoo.


texts: How to get rid of auto generated classes in secondary menu links and add my own classes

texts:
I have taken the standard code for secondary menu from a Drupal 7 theme:

 <?php if ($secondary_menu): ?>
            <?php print $search_form; ?>
          <?php endif; ?>
    <?php if ($search_form): ?>
        <?php print theme('links__system_secondary_menu', array(
          'links' => $secondary_menu,
          'attributes' => array(
            'id' => 'secondary-menu-links',
            'class' => array('menu', 'nav', 'navbar-nav'),
              ),
              'heading' => array(
                'text' => t('secondary'),
                'level' => 'h2',
                'class' => array('element-invisible'),
                  ),
                    )); ?>
                  <?php endif; ?>

Now the ht,l output generates some autogen css witch i whant to get rit of and replace with my own classes?

secondary

My account

Log out

How to delete menu-3 and menu-15 as well as all classes following when we add more links and add some custom links to work with stuff like font awesome?


texts: How to delete the clearfix div of a field (fivestar module)

texts:
I'm using Drupal 7 and Fivestar.

The module fivestar implements systematically a div in the fields of type "fivestar", what gives :
fivestar value
.

I would want to delete this div to have only the value.

I saw that she was implemented at the level of fivestar.module.

I tried a template preprocess but unsuccessfully :

 function THEME_preprocess_field(&$variables, $hook) {
  $element = $variables['element'];
  if ($element['#field_name'] == 'field_NAME') {
    $variables['items'][0]['#prefix'] = '';
    $variables['items'][0]['#suffix'] = '';
  }
}

Would you have a solution ?


texts: Devel issue - "Rebuild the theme registry on every page load" won't work

texts:
I use D7. My site is being hosted on a "Shared" Server at Siteground.com. My site doesn't have any CSS/JS aggregation what so ever (see attachment), and I'm sick and tired of clearing the cache after the smallest of the CSS changes.

Many people told me that installing Devel and enabling "Rebuild the theme registry on every page load" should solve the problem, and will let me see the CSS changes after a refresh (F5/ctrl+r/ctrl+f5), but the fact is that even after I did that and enabled the Theme registry rebuilding option, I still have to clear caches to see the CSS changes, so I'm still stuck with this, and it's indeed frustrating!.

So, why would "Rebuild the theme registry on every page load" won't work? Why do I still need to flush all caches to see the CSS changes?


texts: Are there any Drupal modules that allow you to select a template to use for output or are there any modular content editing interfaces?

texts:
I'm doing some work for a design agency and I'm looking into how I can achieve their fanciful designs using Drupal. In particular I'm worried about the formate of their blog posts, it's quite clear that what they want is not going to be satisfied by any kind of WYSIWYG editor. So I'm left with two options:

Allow them to enter HTML and code up each of the blog posts myself (obviously not desirable).
Limit them to a few different templates that they can use for the future.


texts: Render default value of views exposed filter

texts:
I have a view in Drupal 7 using an exposed filter. When I access the view without any ($_GET) values in the URL I want to display all items. The drop down selection has the value -Any- as I want it, but the view is still empty, even the empty result text will not shown. If I hit the submit-button all items appear.
Already tried different things from post I found about this, but nothing worked so far. I have no Idea why it is rendering nothing at all by default and why I can't make it render something...

Here are my settings for the filter:

Exposed: YES
Type: SINGLE
FILTER Operator: IS ONE OF
Options: -nothing_selected- (already tried selecting everything)
Checked options: Reduce duplicates

I'm using View 7.x-3.5 and have CCK 7.x-2.x-dev enabled.
Hope anyone has an idea. Thanks a lot!

Saduras


texts: Creating menu items for views during installation of a custom install profile fails

texts:
I have created a custom installation profile in which I enable some default features and modules. In the profile I added an extra task at the end in witch I enable a custom deployment module.

That deployment module I then use to enable all project specific stuff. I do this using update_N functions and a script that runs through all the updates on installation of the deployment module.

One of the last updates contains the activation of some features that have a view with a page in code, each with a path but no menu item. I need those menu items but I don't put them in the view to prevent that the view is marked overridden when a user decides to change the menu title of a menu item.

That's why I run another script in a following step that creates default menu items for each view using the menu_link_save function.

The problem is that I can trace the creation of a menu item during installation (I get an mlid back) but when installation is done there are no menu items for the views.

As I understood from another Drupal Question (Drupal installation profile: menu_link_save() doesn't work for "import" path) the problem is that the path's of the views are not defined yet at that moment.

Any suggestions on how to create menu items on installation within an update of that deployment module or is this never going to work?

Thanks in advance!
Hatznie.


texts: How to show view for submitted result of a webform by a user

texts:
How i can show all submitted value of a webform by a user in a view in a tab of a user profile section.

Iam using drupal 6.For example when user click on a tab say form on his profile the webform value submitted by that user show.

Thanks for your help.


texts: Completely hide/remove views exposed form?

texts:
I created a view with exposed filters.
The only purpose of the filters is to have url query parameters, which are controlled through custom UI elements.

There is no purpose in displaying the exposed form.

I can think of a number of ways to get rid of the form. But they all involve custom code that directly targets the view id. So it will be throwaway code, not reusable.

Another option could be to put the exposed form into a block, and then simply not display this block. But this will produce noise in features.

I wonder if there is a more elegant way to do this.
E.g. a contrib module or a piece of custom code which gives me a checkbox in Views UI where I can say "don't show an exposed form".
Maybe an exposed form plugin which does not display the form at all..


texts: How to display users associated with a node through Views

texts:
I would like to create a View that displays users associated with a certain nid.

Under contextual filters, I have checked Content: Nid and selected

Provide a default value - Content ID from URL

Under Relationship, I have selected

Entity Reference: Referencing entity

Then under Fields, I have selected

(User referencing Content from field_office) User: First Name (First Name)
(User referencing Content from field_office) User: Last Name (Last Name)

But nothing is being displayed when I type in my nid into Preview with contextual filters

Essentially what I am trying to do is perform the following query:

$args = array(':nid' => $node->nid);
$results = db_query('SELECT USER_ID FROM USER INNER JOIN node ON USER.OFFICE_ID =
  node.title AND node.nid = :nid', $args);

I have done this before, but accidentally deleted the View. Now I am unable to make the View again, thought the DB structure has not changed at all.

Could someone please point out what I'm missing?


texts: How to limit Entity Reference to only allow referencing of nodes with the same (or undefined) language?

texts:
I know I can simply add language to displayed title of a node in Entity Reference field based on views. What I failed to discover is how to limit possible values to only show and allow matching ones.

When current node is language independent, all nodes should be listed as possible in reference field.
When node has language defined, only nodes of the same language, or undefined language, should be available.

I don't really mind wrong selection to be saved in database if language of node will be changed, as it shouldn't happen often enough to be a problem. I simply don't want "wrong" nodes on the list of available reference choices. On-save validation would be nice, but isn't a must-have.

I tried to use view to populate entityreference field's dropdown on node edit form:

My big block is how to access a language of a current node in view that provides list of available entities. I can't find a way other than to guess using current UI language, but that may be wrong for edits and usually is wrong on new node creation. Ideally, the entity reference field should repopulate via AJAX according to the language selected in the node edit from.

For the sake of future visitors I would appreciate complete answer. Of course answer not based on views will be appreciated, too.


texts: Create user in Drupal 8 but password not working

texts:
I tried to create user in Drupal8 using entity_create. The user is created just fine, but I can't login with the password unless I change it from the admin page.

$authData['name'] = 'testuser';
$authData['pass'] = 'testpass';
$authData['mail'] = 'sss@test.com';
$authData['status'] = 1;
$account = entity_create('user', $authData);

I also tried, the following code (obtained from drush)

$account->pass = 'testpass';
$account->save();

and also $account->setPassword

none of above works.


texts:
I must be missing something because I can't determine what I'm doing wrong. I've got a D7 site, and we're running Drush 8.1.10
I'm trying to run through some updates but I keep running into this error:
It's not allowed to store backups inside the Drupal root directory.
I don't have the backups directory inside the drupal root directory - or at least so far as I know, it's not. I've set the directory to be one level above the webroot and declared it in my settings.php as follows:
/** declaring the private files directory
*/
$settings['file_private_path'] = '/var/www/vhosts/drush-backups';

In my file system I've also got my private files path set to the same to the same dir just trying to figure out where this issue is coming from.
Can someone help me figure out what I'm missing?


texts: How to add class to view block programmatically

texts:
I need to add class to view block programmatically, but could not find working way to do it. My view format is Unformatted list.
I have this in my template.php:

function theme_preprocess_block(&$variables){

  // Add arbitrary class to specific block
  if ($variables['block']->module == 'front_tiles') {
    $variables['classes_array'][] = 'my-special-class';
  }
}

Any help?

SOLVED
Changing:

if ($variables['block']->module == 'front_tiles') {

To:

if ($variables['block']->module == 'views') {

Now it will affect to views blocks.


texts: Don't show end-date for single-day event; show it for multi-day event

texts:
I have one multi-entry date field in an event content type.
In the event view, I use multiple date fields with different date types to display the date as
MMM dd-dd
start:time - end:time

The view is perfect for a multi-day event i.e.
Apr 10-14
8:00 a.m. - 3:00 p.m.

But for a single-day event, the the view is not desirable i.e.  Apr 10-10
      8:00 a.m. - 3:00 p.m.

Can I set up something conditional in the view to display a single-day event differently than a multi-day event?  OR, how can I hide the end date (not time) if it's the same as the start date?
i.e.  Apr 10
      8:00 a.m. - 3:00 p.m.


texts: How to alter views exposed form and add ajax to filters

texts:
I have a views with 2 exposed filters - both taxonomy reference, select.
I want to limit options in second filter based on user selection from the first. Tested with enabled/disabled ajax in views - no difference. Tested with exposed form in block - no difference.

Error message replace target filter: "An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (60 MB) that this server supports."

Using standard form alteration and ajax in form exposed filters, the filtering produce error. This work fine in custom form, but not in views exposed filter.

<?php

use Drupal\Core\Form\FormStateInterface;

function mymodule_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if ($form_id == 'views_exposed_form') {
    if ($form['#id'] == 'views-exposed-form-articles-page-1') {
      //kint($form);
      //kint($form_state);
      //
      $form['field_tags2_target_id']['#prefix'] = '
';
      $form['field_tags2_target_id']['#suffix'] = '
';

      $form['field_tags_target_id']['#ajax'] = [
        'callback' => 'tags_ajax_callback',
        'wrapper' => 'tags2-replace'
      ];
    }
  }
}

function tags_ajax_callback($form, FormStateInterface $form_state) {
  // remove test2 1 (tid 3) from Tags2 options
  unset($form['field_tags2_target_id']['#options'][3]);

  $response = new AjaxResponse();
  $response->addCommand(new ReplaceCommand(
    '#tags2-replace',
    $form['field_tags2_target_id']
  ));
  return $response;

  //return $form['field_tags2_target_id'];
}

How to make this work?


texts: Make menu link expand instead of redirect

texts:
Let's say that I have a following menu:

A

A1
A2

B

Which looks like this:

When somebody clicks on the arrow on the right of A (or in the empty space on the left of the arrow) the submenu expands, but when they click on A it redirects to the page set in admin/structure/menu/item/785/edit.

I want A to also expand the submenu instead of redirecting. How do I achieve that in Drupal 7?


texts: Where do I put image style definition in a module?

texts:
I'm writing a custom node formatter that needs to use a certain image style. Since I don't want to rely on that image style being defined by the admin, and I want to be sure the style is not deleted, I am going to provide the style definition in code.

Should MYMODULE_image_default_styles go into the .install or .module file?


texts:
I have class like this:

<?php

namespace Drupal\mymodule;

use Drupal\comment\CommentInterface;
use Drupal\comment\CommentManagerInterface;
use Drupal\comment\CommentStorage;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Session\AccountInterface;

class MyCommentStorage extends CommentStorage {

  /**
   * {@inheritdoc}
   */
  public function __construct(EntityTypeInterface $entity_info, Connection $database, EntityManagerInterface $entity_manager, AccountInterface $current_user, CacheBackendInterface $cache, LanguageManagerInterface $language_manager) {
    parent::__construct($entity_info, $database, $entity_manager, $current_user, $cache, $language_manager);
  }

}

and my file service:

services:
  comment.storage:
    class: Drupal\mymodule\MyCommentStorage
    arguments: ['@xxx','@database', '@entity.manager', '@current_user', '@cache.entity', '@language_manager']

I don't know add @xxx service to pass first argument in my method construct.I don't find any service implement interface EntityTypeInterface. So what's service I need add to first argument?


texts:
I have added some jQuery functionality to create a popup when hovering over a link to the script.js file included with the particular theme I am using. It is enclosed in jQuery(document).ready(function($) {}.

It works perfectly at first, but it seems that once Drupal 7 caches/aggregates the script.js file, it no longer works at all. I'm not 100% sure it is a caching related issue, as it works fine for hours, but eventually stops working. Clearing the CSS/JS cache after it stops working makes it work again.

function contactLinkInit() {
        var div = '
' +
                '10320 Globe Road
Morrisville, NC 27560
' +
                'Phone: 919-361-4333
' +
                'Fax: 919-361-4388
' +
                'info@dosoffice.com';

        var firstRun = true;
        var firstEntered = true;
        var enteredPopup = false;

        $("a.contact-link").mouseover(function(event) {
            if (firstRun) {
                $("body").append(div);

                $("div.contact-popup").mouseover(function() {
                    if (!firstEntered) {
                        enteredPopup = true;
                    }
                    else {
                        firstEntered = false;
                    }

                    $("div.contact-popup").css('visibility','visible');
                });

                $("div.contact-popup").mouseout(function() {
                    enteredPopup = false;
                    $("div.contact-popup").css('visibility','hidden');
                });

                $("a.contact-link").mouseout(function() {
                    if (!enteredPopup) {
                        $("div.contact-popup").css('visibility','hidden');
                    }
                });
                firstRun = false;
            }
            $('div.contact-popup').css('left',event.pageX + "px");      // <<< use pageX and pageY
            $('div.contact-popup').css('top',event.pageY + "px");
            $("div.contact-popup").css('visibility','visible');
        });
    }

    contactLinkInit();

I'm sure what I've done here is not best practice, neither Javascript nor Drupal are my forte. Not only am I looking for a solution to the problem itself, I certainly wouldn't mind suggestions as how to improve the code itself.


texts: JQuery Causes Seemingly Endless Loop and page load times of 1 minute + - "Warning: reference to undefined property D.cache[a][d]"

texts:
The rendering of my pages on my website have slowed down drastically.  When I turn on the error console I get the image below that shows the error:

Warning: reference to undefined property D.cache[a][d]

You can see a screenshot below:

These warnings continue until the browser memory becomes bloated, the browser locks up, or the page simply takes over a minute to load!

I am at a loss for how to debug this issue b/c when I open the file cited in the warning, it is the long minified jquery script.

How can I go about fixing this issue?


texts:
I'm sure there's some simple reason that my custom validate function isn't executing.

Here's my code:

function MYMODULE_form_message_ui_instance_message_manage_alter(&$form, &$form_state, $form_id) {
  array_unshift($form['#validate'], 'MYMODULE_validate_relationship');
  watchdog("form", "
" . print_r($form, true) . "
");
}

function MYMODULE_validate_relationship($form, &$form_state) {
  watchdog("validate form state", "
" . print_r($form_state, true) . "
");
  watchdog("validate form", "
" . print_r($form, true) . "
");
}

On form submission, the first watchdog - "form" is being exected, however the second and third are not. Why is this? I can't find any information on why a custom validate hook wouldn't execute.

EDIT per Pierre's request:

I am writing a custom validation function that I am trying to execute before the other validation functions. I am doing this using array_unshift. This seems to be working, as my #validate array looks like this:

[#validate] => Array
    (
        [0] => MYMODULE_validate_relationship
        [1] => message_ui_instance_message_manage_validate
        [2] => message_private_form_message_private_instance_message_manage_validate
    )

However the code in MYMODULE_validate_relationship is never executing.

As far as I can tell, $form and &$form should be irrelevant in the validate function, because once you're at the validation stage, nothing should actually be modifying the form (I think?). And most examples I was seeing did not including passing the $form by reference. And I've tried both ways, and in neither way is the validate hook firing.


texts: How can I save what filters a user wants when viewing a view?

texts:
I don't know if this is possible but, I would like to allow my users to be able to filter out what content they would like to show up in a view so that every time they return to that view, their preferences are saved.

I no how to allow my users to filter content in a view but I'm having trouble saving it. I'm trying to allow my users to control their own news feeds.

I've tried looking around for a module to do this and I've been playing around with views for a while but I can't seem to hack something thing that does what I outlined. Any help would be appreciated. Thanks.


texts: Is there a way to use tokens in a Views: Link Display setting?

texts:
This question pertains to Drupal 7 and Views 3 (specifically 7.23 and Views 7.x-3.7):

Is there a way to enable the use of custom tokens within Drupal Views Link Display settings?

My use case is a View Block with a More Link, which needs to point to a dynamic URL.

I was hoping to enable the use of tokens derived from this View's Fields (such as path or id) within the Link Display setting, so as to generate a custom More Link url.

Thanks!


texts: How can I get the number of comments per page?

texts: I need the value "default comments per page" for special theming in comments-type.tpl.php for Drupal 6. Should I use variable_get()?


texts:
Will this be correct :

drupal_set_title(check_plain(t("Donation Details for Project: $project->title")))

I want all of the string to be translated when needed. Should call check_plain first then t or vice versa?


texts: How do I get the current path and add a condition in page.html.twig?

texts:
I have the view page called "location/all" which contain all the map details.

I changed some CSS styles.

{% if 'location/all' in url %}

{% else %}

{% endif %}

I tried this code to check the condition, but every time it executes the else part.


texts: How to autoexpand everything on a view translation edit form?

texts:
To fully translate a view into one language I have to expand dozens of collapsed panels, most of them with only one or two subelements.

I've reported it here. But is there a quick workaround, like a module or setting that automatically expands all these panels?
I tried using hook_form_FORM_ID_alter but changing the #open value is ignored (note that it's a top-level Displays panel #open which is true by default):
 /**
 * Implements hook_form_FORM_ID_alter().
 */
function custom_admin_form_config_translation_edit_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  foreach ($form['config_names'] as $key => $config_name) {
    if (substr( $key, 0, 1 ) !== '#') {
      $display = $config_name['display'];
      $display['#open'] = false;
    }
  }
}


texts: How to access and change a form's display mode in hook_form_alter() or similar?

texts:
Is it possible to access and change a form's display mode in hook_form_alter()? I'd like to use some context to say "use this display mode, not the other one."

My specific use case is selecting a form display mode for a paragraph type nested (in multiple layers) inside one of several node forms. Based on details of the parent layers, I want to control which form display mode is used.

I've looked at hook_field_widget_entity_reference_paragraphs_form_alter() and hook_entity_form_display_alter() as well. While I could, it seems in principle, change the display in that last one, there's no information I could use to make the decision. The widget function doesn't seem to provide anything that looks potentially useful.

I would expect some sort of connection from either the $form or $form_state in hook_form_alter() to the display being used, but can't find one. Either I haven't dug down the right rabbit hole, or that connection doesn't exist there, and I need to look at some other processing step, but don't know which.


texts: Using cache tags for a particular node list

texts:
Caching in Drupal 8 is great, but documentation is thin (at this time) on using cache tags for render arrays in Drupal 8.

I have some code that basically generates a list of node teasers, say for content types "books" and "magazines". I'm caching the list to speed things up. I would like to refresh the list every time a "book" or "magazine" is added/deleted/edited. So I have a render array that looks like this:

$build = array(
  '#type' => 'markup',
  '#markup' => $sMarkup,
  '#cache' => [
    'keys' => ['home-all','home'],
    'tags'=> ['node_list'], // invalidate cache when any node content is added/changed etc.
    'max-age' => '36600', // invalidate cache after 10h
  ],
);

By using the cache tag ['node_list'], the cache invalidates properly when content is added or edited, but will also invalidate when a content type not being listed here is changed, say "casette".

What cache tags can I use to limit the invalidation to when only "book" or "magazine" is added/changed/deleted? I've tried using: ['book_list','magazine_list']
but that doesn't work.


texts: How can I manually edit the search options in a facet block?

texts:
I have a facet for a field, the values of which are:

(FACETAPI DEFAULT)

yes (db: y)
no (db: n)
maybe (db: m)

By default, the facet shows all three of these options.  However, I only want to show yes or no to the user, and I want to include the value of maybe in both:

(WHAT I WANT)

yes (db: y or m)
no (db: (n or m)

What I have tried

I know I could try to do an OR search with the facet and rewrite my links to search both, but I don't want to give users the option to search just "maybe"; I only want two options, not three.

It would be great if there was a stable version of the Apachesolr Facet Builder for D7.  One can dream...

I am using the Facet API Bonus module but this allows me to "Rewrite items" or "Exclude items," not combine three items into two as I described above.

I read this wunderkraut article on extending Facet API but it covers adding sorts, plugins, widgets, dependencies, and the like-- not the facets themselves.

I also looked at this wunderkraut article, which suggests I should use something like hook_facetapi_facet_info_alter(), but I don't know how to edit the field values to combine them.


texts: Get value from a field in another content

texts:
I have two content types : content_type_1 and content_type_2.

I'm trying to call a value from content_type_1 in content_type_2 according to an entity reference field in content_type_2 which point to the nid of content_type_1.

I tried to do it with a computed field with the above code :

$entity_field[0]['value'] = "db_result(db_query("SELECT field_CONTENT_TYPE_1_value FROM content_type_CONTENT_TYPE_1 WHERE nid=%d",$node->field_CONTENT_TYPE_2[0][nid]))"

field_CONTENT_TYPE_1 is the field I want the value from
content_type_CONTENT_TYPE_1 is the content type of field_CONTENT_TYPE_1
field_CONTENT_TYPE_2 is the entity reference field which point to nid.

I have to say I'm absolutely not a php dev, so I'm just playing with php snippets I found around.

What's the way to achieve this with computed field ?


texts: Make Admin fieldset open by default when editing comment

texts:
As supplied by the core comment module when you go to edit a comment as an admin there is an Administration fieldset that lets you change the author and if the comment is published. When you load the page the fieldset is collapse and I'd like it to be open by default.

I found in the comments.module this bit of code:

// Display author information in a fieldset for comment moderators.
if ($is_admin) {
$form['author'] = array(
  '#type' => 'fieldset',
  '#title' => t('Administration'),
  '#collapsible' => TRUE,
  '#collapsed' => TRUE,
  '#weight' => -2,
 );
}

Is there a hook or something I could use to manipulate this?


texts: How to use the table header instead of an exposed dropdown to sort a Views table?

texts:
I have a view where the format display is a Table.

I exposed some field for sorting. The problem with that is, instead of activate the Table Header for the choosen sorting field in order to sort, that's created a dropdown where the user can choose the sorting field.

Is there a way to use to Table Header for sorting instead of this generated dropdown.


texts: How to add field content as class in Twig?

texts:
I want to add the content of a field (i.e. "workshop") as a class in field-html.twig

i tried

{%
  set classes = [
    'field',
    'field--name-' ~ field_name|clean_class,
    'field--type-' ~ field_type|clean_class,
    'field--label-' ~ label_display,
    'icon-' ~ item.content,
  ]
%}

but it only shows "icon-" as a class.


texts: Prices table - show individual user prices - contextual filters?

texts:
Have spent many hours searching web for an answer with no luck...

I have: PRODUCTS (many) and USERS (many) each user has his own price for each product.

I need:

generate price table to edit prices (products are rows columns are users),
generate personal prices table for each user (a tab on his account page)
add new products and users with minimal amount of work

Right now I have a content type PRODUCT with fields for prices for each user.
And I don't know how to generate personal price lists for each user an their profile page. Can I use contextual filter to show just one column from big prices table?

Any help would be greatly appreciated!

Oskar :)


texts: Is there any performance implications in calling a view programmatically and set necessary filters?

texts:
I have a view that list some items depending on the current node loaded. I also want to add few exposed filters to the view. The exposed filters cannot be shown to users directly. I want to provide a separate set of filters (to display) for users and based on what user selected, I want to set one or more filters of the view.

For example: I want an option for user to show only nodes that are not older than 7 days, 14 days etc so I will provide a list with All, 7 days, 14 days etc and when user select any of these, I want to set the exposed filter for node created time and with the calculated value - the date 7 days or 14 days or so from now.

There are several filters like this - ie based on what the user selected, we need to apply different filters in view.

To implement this, I plan to implement a block, in which I can programmatically call a view

$my_view_name = 'the_view';
$my_display_name = 'block';
$my_view = views_get_view($my_view_name);
$my_view->set_display($my_display_name);

if ($option == FIRST_OPTION) {
  $my_view->exposed_input['filter1'] = $option1_calculated_value1;
  $my_view->exposed_input['filter2'] = $option1_calculated_value2;
}
else {
  $my_view->exposed_input['filter1'] = $option2_calculated_value1;
  $my_view->exposed_input['filter2'] = $option2_calculated_value2;
  $my_view->exposed_input['filter3'] = $option2_calculated_value3;
}

$my_view->execute();
unset($my_view->exposed_widgets);
return $my_view->preview();

Is there any problem in using this method? Is there any other way to do this? Is there any performance implications in using this method? Will views caching etc work in this case? I use Drupal 7 and Views 7.x-3.7


texts: How do I tell Drupal 8 to use my custom module's theme template when rendering an image that is linked?

texts:
I'm building a custom module to extend the default image field. It adds additional attributes that relate to the image field on a per content type basis. At this point it will take and store the attributes => values and when calling hook_preprocess_field() they can be returned (printed) so I can rest assured that they are indeed storing and relating correctly. The final part of the puzzle is to assign my twig template and insert my custom attributes. I thought that hook_theme() would do the job but so far I have failed and I can't find any suitable documentation on the subject when it comes to fields or image fields.

How do I tell Drupal to use my custom module's template when rendering an image that is linked?


texts: How to mandate the password policy in custom form fields?

texts: I have custom form which has password field values and by using that user will be created in our website. So the requirement is to use password policy module functionalities to this form also. The form is able to show the policies below the password field and now those suggestions like use alphanumeric etc.. are not mandatory. But how I can mandate the password must contain alphanumeric etc etc... Please help me in this regard.


texts: Can't choose checkboxes as field widget in d7

texts:
I recall in previous versions (Or maybe even this version and mine is just bugging) you could take text or int fields and supply a list of key|values and make checkboxes or a selectbox from it.

The core module "Options" seems to offer this functionality from the module description but whenever I select field type Integer, Decimal, Float, or text the only widget option I have is a standard textbox.

Term and node references do allow checkbox widgets.

Am I seeing a bug? Is there a different way of doing this in D7? I've tried adding these field types to both node types and vocabs but neither acknowledges the existence of the checkboxes widget.


texts: Updating the CKeditor library in Drupal after Version 7.14?

texts:
I will now quote from CKeditor project page at Drupal.org:

To use CKEditor in Drupal, you may need to download CKEditor (the library which this module relies on). This would not be necessary starting from version 7.x-1.14 (not released yet - 24 April, 2014), where the installation has been simplified and CKEditor from official CDN is available by default.

As you could see in the picture, my sites/all/modules/ckeditor/ckeditor folder is empty, i.e the folder where you put the library... So my question is, given that the library's folder is empty by default, is it even possible to update the JS library but not the module...? Is it even possible after version 7.x-1.14? Or should I wait to the coming Drupal module release? Thanks.


texts: Add type='tel' attribute to webform field

texts:
I want to add the html5 tel attribute to a particular field in my webform form in order to prompt mobile devices to display the appropriate keyboard.

I was trying this:

function my_module_form_alter(&$form, $form_state, $form_id) {

    /* add html5 phone type for phones and smarter devices to use */
    /* usage: just include the word 'phone' in the field title and have the field of type 'textfield' */

    foreach ($form['submitted'] as &$field){
        if (is_array($field) && isset($field['#title']) && stristr(strtolower($field['#title']), 'phone') && isset($field['#type']) && ($field['#type'] == 'textfield')){
            $field['#attributes']['type'] = 'tel';
        }
    }
}

but the attribute doesn't get applied and the resulting field has the type of "text"

I suspect there may be a hook for webforms that will let me adjust the output, I just can't find it.


texts: drupal Bootstrap main menu toggle button no work when add second menu to block region

texts: the right side is the main menu toggle using superfish menu, and the blue color area is the second menu to the block region in bootstrap help region block. The toggle menu can not drop down. If i take out the second menu the main menu toggle button is work. Please help for figure out what is the problem.


texts: Best practice for moving content from production server to dev server

texts:
I have used GIT to build my Drupal 7 site (following these guidelines). In order to move changed content downstream before updating the site – in order not to overwrite new content with old content – I would like to find out what the best practice is for that. I was thinking about using the d2d migration module, but maybe there are more established and proven methods?

How do the professionals do this?


texts:
This is going to be a ridiculously simple question and after getting this crazy view working, I don't' know why I can't figure this out.

I have created a view from entityform and field collections.  Got everything working, displays what I want. The user clicks on the link in the nav, page opens, exposed filter is displayed, along with the results of the view which is everything in the db/view.

I only want the user to see the exposed filter when they click on the link to the view/page, then the user will add the 'item number' to the filter, click search/apply and see the results. I am hoping I don't have to create another view and link things.

How can I accomplish this?


texts:
Please how can I filter the taxonomy depth of type user in views?

Users have taxonomy as follows:

country
-city1
-city2

The view is set up as relationship=field-country and able to create a context filter with term id.

The problem is that, although the link to the child city works fine, the link for the country doesn't work. In other words, we need a depth capability for the parent term.


texts: What are the variables does one search for when trying to render a custom form?

texts:
In Drupal 8, the following code renders the node creation form (node/add/page) when integrating it into a custom module:

$node = \Drupal::entityTypeManager()
  ->getStorage('node')
  ->create(['type' => 'page']);

$form = \Drupal::service('entity.form_builder')->getForm($node);

print \Drupal::service('renderer')->render($form);

We know the module in question is the Node module, which generates the content type page. What should I do to render the user creation form (/admin/people/create)?

I can easily change the code to the following, and replace 'node' with 'user' and 'page' with 'user'.

  ->getStorage('user')
  ->create(['type' => 'user']);

This would now render the user creation form. For me to come to the conclusion that it would render the user form was only a guess and apparently it works. But this problem solving approach will not work if I wanted to render some other form that might not be so obvious.

What does one have to grep for in the code base or other investigative work to come to the conclusion of the following 2 lines in the above code?


texts:
I use this solution for now which works great: It's with Computed fields, and I use this line: $entity_field[0]['value'] = ip_address();

So basically what it does, it's when a user submits a new node, it also attach his IP address to the node, which is great.

The problem is that if another user decides to edit the node, the IP field is being updated with the editors IP. Which is bad.

The IP should be printed only of the author of the node. And no matter how many other IPs edits the node, those should be ignored.

So, I was thinking maybe there was possible to do this by editing the PHP line or am I looking in wrong direction?


texts: Obfuscating email addresses displayed by Views?

texts:
I'm working on a View that displays a user's email field as a mailto. Given this is a recipe for spam, I'm wanting some way of obfuscating it.

I thought I'd go with Invisimail, but it (and seemingly ever other similar project) relies on a text filter. Given that the User email field doesn't use input formats, this makes it useless for my particular application.

I suppose I could create a separate email field, but I'd really like to not have to.

In short -- How do I obfuscate a user email field displayed via Views?

Thanks!


texts:
I have created for a mobile site a form to collect daily readings using a content type and that is working like a charm. The question is:

Is there a method, way, module or hack where I can setup some sort of form where the same content type form will be display 7 times (one for each day) and the common fields be merge into one?

The reason for my question is that the regular form make sense to be fill using a mobile device, but if someone wants to use a desktop computer it will make more sense to enter the 7 days of data at once.


texts: Extra template name suggestions for main-menus based on regions

texts:
In the first look, the process of solving this problem maybe seems very easy, but this problem makes me really confused.
Imagine that I want to have two main-menu one in the header (primary menu/ top bar) and another in the footer region of my site with different style and template.
By default, there is no file suggestion that differentiates which twig file to be used for a menu based on the region.
That's why I follow below article to add block region as the id of main-menu and make block's template name suggestion unique and dedicated for next customization.

Drupal 8: Theming menus by KristianKaa

function THEMENAME_preprocess_block(&$variables) {
  $variables['content']['#attributes']['block'] = $variables['attributes']['id'];
}

function THEMENAME_theme_suggestions_menu_alter(array &$suggestions, array $variables) {
  if (isset($variables['attributes']['block'])) {
    $hook = str_replace(array('block-', '-'), array('', '_'), $variables['attributes']['block']);
    $suggestions[] = $variables['theme_hook_original'] . '__' . $hook;
  }
}

But the following HTML comments, are the theme hook suggestions added by the debug function, for the Main navigation blocks after adding those codes.

Header section:

<!-- FILE NAME SUGGESTIONS:
   * menu--main.html.twig
   * menu--main--mainnavigation-2.html.twig
   x menu.html.twig
-->

Footer section:

<!-- FILE NAME SUGGESTIONS:
   * menu--main.html.twig
   * menu--main--mainnavigation-2.html.twig
   x menu.html.twig
-->

As you can see from the suggestions, there is nothing to distinguish the two menus from one another based on regions.
I think this template name suggestion hasn't any efficiency in this case because what's that suggested isn't semantic.

So my main question is: How can I add extra filename suggestions for main-menu based on regions not block Id? Or
How to get the current region inside the Hook_theme_suggestions_menu_alter, to add my own suggestion?

I read below posts also but all of those add block Id as twig suggestions for menus:
Additional twig suggestions for menus
How to create a custom Twig Template for Menu Block
How to make a theme hook suggestion for menu according to the region?


texts: How do I install/use flowplayer with my drupal 7?

texts: I am a complete beginner to drupal and I am currently working on a project to set up a live streaming website. I am using iis7 as my web host and I want to integrate it with WOWZA server. I've been trying to follow this guide(http://www.ebremer.com/encore/originalproject) that uses swftools to embed flowplayer but the module is not available for drupal 7 so I'm trying to manually configure flowplayer to work with my website. I've successfully installed Flowplayer API module and downloaded the free version of flowplayer onto my server in sites/all/libraries/flowplayer like the readme.txt for the flowplayer api tells me to. But I go into admin/configuration/media/flowplayer on my drupal site it tells me that I need to install and set up flowplayer. How would I do that?


texts:
How can I extract my content from the database?  My specific use case is to be able to migrate my content out of Drupal to do a 100% clean re-installation and then restore all my original content, but just in general, it seems to be a huge gap in the design of a content management system that I can put content in to be managed, but I can't get it back out again.

I understand that there are a myriad of variables in this use case such as module-specific tables that may contain some of my content.  I'm asking about the base case without regard to those individual considerations.  I would like to start simple; I can address additional, specific factors as they come up.

In searching online, I've only found workarounds to this issue.  I'm not asking about workarounds (eg. the Features module) or ways to do something else that is similar to my question.  Is it possible to extract my content from the database--at the very least, for the purpose of reloading it into a new, identical installation.

Put another way: in a vanilla installation, in what tables is the content stored?


texts: Retain revision author when editing revision

texts:
I am using the Revisioning module and it has an option when saving nodes: 'Modify current revision, no moderation'.

When selecting that option I want to retain the node revision author.

So far I think I need to do this:

Create my own submit callback for node_form and replace the submit button with my own so that the default submit handler is not called.

Copy the code out of the default submit handler into my new hander. Then before node_save is called I must impersonate revision author if my condition is met.

Is this right, or is there a better way to achieve this?


texts: How do I get the submitted moderation state of a custom block?

texts:
I am a bit new for Drupal and currently working on Drupal8. I need to implement custom restrictions for workflow. Basically i want to get the submitted value of moderation_state filed in mymodule_form_alte

Here are the things that i have tried but all returns Null. The strange thing is that the below method works for node but do not work for block_content

 function mymodule_form_alter($form, &$form_state, $form_id) {
   $formSate = $form_state->getValue('moderation_state')[0]['valye'];
   var_dump($formState); // Output : Null

   $formSate = $form['moderation_state']['widget']['#default_value'];
   var_dump($formState); // Output : return the default value of dropdown not the one that i have selected
}

Here is the moderation_state field


texts: How can I override or alter a module's help text?

texts:
I am trying to override or alter Layout Builder's default help text. Is is possible to do this? If so, how?

I have added some help text in a hook_help() function in a custom module but I can only get it to add to Layout Builder's help text. I can't find a way to override the default text.


texts:
We have a multilingual website set up and functioning fine.  The next step was to setup translations for the default Drupal account emails (e.g. Welcome, Account activation, Account blocked etc).  This is also done - and our client can go in and add translations for each of these.

The issue is - the client is asking; seeing as these are default Drupal emails, have the translations already be done for each language?

We have the l10n_update module pulling down translate updates to core and each module - but the account emails are not receiving translates.

Does any one know if these emails have already been translated? Can anyone provide some insight? We've searched and haven't come across anything

thanks


texts: How do I load a Media entity from a File entity?

texts: I have a File entity loaded programmatically. I want to load a Media entity from it. Is there a way to achieve this?


texts: Webform Custom element option values validate

texts: Can anyone please suggest how to validate the custom element option values ( select). This validate should work, once we add new element to the form and fill the option value and then click save / save and add element.


texts: Two domains pointed at the same site, can't log in to one of them

texts:
A client has two domain names, a .ca and a .com, that both point to the same D7 site (same codebase, same database, no custom sites folder for either of them, so it's not a multisites situation; the Apache document root path is simply the same for both sites). Everything works fine except that nobody can log in to the .com version. There is no "unrecognized username or password" or other error generated, it just doesn't log them in. (Incorrect passwords do generate the error message.) Checking the log messages, I see that it opened and then immediately closed a session.

Changing cookie settings is not a viable approach here, because it's different top-level domains, not different subdomains.

One possible solution is to redirect one domain to the other instead of running them "in parallel" (I'm aware of the methods, pros and cons of this approach), but I'm interested in why this is and what else can be done about it.


texts: Bug in setError when using unlimited cardinality with custom FieldType

texts:
I have recently added the field_example (Color RGB) custom field type to my Drupal instance (Drupal version is 8.9.1), didn't make any changes to the example code, and found that when using unlimited cardinality once I enter a value and press the "Add more items" button, the fields don't show validation errors on the first element.

However, if I the first element is a valid HEX value and I try to add an invalid value after it, the validation error messages are displayed as expected.

Is there a workaround for this bug?
PS: The code was checked out from https://git.drupalcode.org/project/examples.git branch 8.x-1.x
The file in question is https://git.drupalcode.org/project/examples/-/blob/8.x-1.x/field_example/src/Plugin/Field/FieldWidget/TextWidget.php


texts: How do I fix the "Access denied" error in Organic Groups when I am logged in as admin?

texts:
I am logged into my site as uid=1 (admin) but I cannot edit the /admin/config/group/roles/node/team page ("Team" is an Organic Group content type), due to getting an

  "Access denied - You are not authorized to access this page."

I have cleared the cache, rebuilt the permissions, and tried a number of other tricks to gain access, all to no avail. Any ideas?


texts: Upload multiple files through a single file dialog?

texts:
In a Webform, I want to let the user upload multiple files via one call of the file dialog. I found the following modules.

Webform Multiple File Upload
Webform Multiple File

With either of them, I cannot open the file dialog once and select all the files. Instead, I need to open the file dialog again for every file.

Is there a way to allow file uploads in one go for Webform forms?


texts: Implement Push Notification in my iOS App with a Drupal backend

texts:
I building an iOS App whose content is being brought from a Drupal site. It is being built in ionic/AngularJS.

I intend to implement "Push Notification" functionality in my app that whatever notification a user sends through my Drupal site is received on my app.

There is a particular module Push Notification, made specifically for this and has integration with Services, but I can't seem to figure out how I'll show the Push Notification on my app when it's sent from my Drupal site. Probably some small example?

Any help would be highly appreciated.


texts: I am trying to add a 'Login using Google' type login page. But I cant find any module that does it out of the box. Could anyone help me proceeding in the right direction as to creating a module that would allow user to sign up with their google account?


texts: How to create a custom Twig Template for Menu Block

texts:
I'm using a menu block to output a section of my main menu into a region so I can have a "In This Section" type of sub menu on every page.

Unfortunately, I can't find a way to pinpoint in menu.html.twig which rendition of "main_menu" I am working with.  (they both have the same "menu_name") I want to adjust the markup for the menu block, but not for my main menu.

A similar question was asked here:
Additional twig suggestions for menus in Drupal 8

I don't quite understand the suggested answer.  Is there some way I can extend some class to call a different Twig Template?  Is there some hook I'm missing?


texts: 7 - How to create a view using ApacheSolr?

texts:
How am I able to create a view using ApacheSolr as base in Drupal 7?

All I can see when creating a new View, is ApacheSolr localhost server which doesn't give me the fields that I need, found few links online but none of them helped! very confused!

I am using :

Apache 7.x-1.0-rc4
Drupal 7
Views 7.x-3.5
Apache Solr Search Integration 7.x-1.0-beta1


texts: Enabling aggregate and compress CSS files caused error on site access

texts:
I set this tick box in the performance area, and on clicking Save I now cannot access the site, even the performance area to disable this! any one know if I can directly change this in the DatabasE?

EDIT:
I have refreshed the Database, thankfully no updates since it went live. This does raise the question though as I'm not the only one who has had problems with these performance tick boxes, how do you back out of an error?

I would still like the answer cause i'm trying to get to the bottom of these performance settings.

thanks for any replies.


texts: Creating quicktabs prorgammatically: code worked in D6 not in d7

texts:
I created a custom quicktabs module in drupal 6 that adds a block, and it is working just fine. Before moving it over to drupal 7, I edited the module and info files accordingly, but the module displays no block on admin/structure/block and the version of the module doesn't appear on admin/modules.

I have added the feeds and their blocks are displaying content and the bids are identical in both versions of the site.

I have read this and this and even tried this, but haven't found the solution. I have run cron and cleared cache when you would be expected to.

If I add a print_r($tabs) I get an array with all of the array pieces as designated below for the right days.

quicktab_custom.info file

name = quicktab custom
description = custom quicktab block for event data
core = 7.x

quicktab_custom.module file

/**
 * Implements hook_block().
 *
 * We want to define a quicktabs block.
 */
function quicktab_custom_block($op = 'list', $delta = 0, $edit = array()) {

switch($op) {
// 'list' shows the items in admin/build/block admin page
// we alsohave: configure, save, view
case 'list':
  $blocks['quicktab_custom_quicktabs'] = array(
    'info' => t('events this week'),
    'cache' => BLOCK_NO_CACHE,
  );
  return $blocks;
  break;
case 'view':

  switch ($delta) {
    case 'quicktab_custom_quicktabs':
     $today = date('D');

      //set tab content
      $tabs[] = array(
        'title' => t($today),
        'type' => 'block',
        'bid' => 'aggregator_delta_feed-14',

      );
      $tabs[] = array(
        'title' => t(date('D',strtotime($today . ' +1 day'))),
        'type' => 'block',
        'bid' => 'aggregator_delta_feed-15',

      );
      $tabs[] = array(
        'title' => t(date('D',strtotime($today . ' +2 day'))),
        'type' => 'block',
        'bid' => 'aggregator_delta_feed-16',

      );
      $tabs[] = array(
        'title' => t(date('D',strtotime($today . ' +3 day'))),
        'type' => 'block',
        'bid' => 'aggregator_delta_feed-17',

      );
      $tabs[] = array(
        'title' => t(date('D',strtotime($today . ' +4 day'))),
        'type' => 'block',
        'bid' => 'aggregator_delta_feed-18',

      );
      $tabs[] = array(
        'title' => t(date('D',strtotime($today . ' +5 day'))),
        'type' => 'block',
        'bid' => 'aggregator_delta_feed-19',

      );
      $tabs[] = array(
        'title' => t(date('D',strtotime($today . ' +6 day'))),
        'type' => 'block',
        'bid' => 'aggregator_delta_feed-20',

      );

      $quicktabs['qtid'] = 'quicktab_custom_quicktabs'; // machine readable name
      $quicktabs['hide_empty_tags'] = TRUE;     // hide tabs that are empty
      $quicktabs['default_tab'] = $today;   // set the default tab
      $quicktabs['tabs'] = $tabs;       // all tabs with content
      $quicktabs['style'] = 'Navlist';      // tabs theme -- originally set to Sky
      $quicktabs['ajax'] = FALSE;       // ajax or not
      $block = array('subject' => '', 'content' => theme('quicktabs', $quicktabs));

      return $block;
      break;
  }
 }
}


texts: Auto approve an user after registration (Services)

texts:
Is there some way to auto approve an user after registration? I don't want to send any email confirming the email or changing the password.

I'm trying to build a register/login for an app with REST services, but I don't want the user have to check the email to change the password, I want the user can use immediately the password it just filled in the registration.

I tried adding this line in settings.php $conf['user_mail_register_no_approval_required_notify'] = FALSE; but the user continues as (not verified).

Thanks!


texts: How to add a value to an entity reference field set to unlimited values using entity metadata wrapper

texts:
Im new to drupal and im trying to perform this operation, can some one help me on how can i add a new value to an entity reference field that its been set to hold unlimited values using the entity metadata wrapper only
this is what i have tried

$ewrapper->entity-reference-field->set($value);

this will overwrite the current value and i want to add to it


texts:
I have a really annoying typo right through my Drupal install (db table names, modules...you name it it's right through). Ideally I would like to fix the typo and not recreate the content type/modules etc.

The process I have gone through so far:

Find/replace all instances of the typo in the Database using this Script https://gist.github.com/leewoodman/9544808

I then renamed all the tables where the typo occurred using this:

RENAME TABLE field_data_field_accomodation_ref TO field_data_field_accommodation_ref,  field_data_field_offer_accomodation TO field_data_field_offer_accommodation, field_revision_field_accomodation_ref TO field_revision_field_accommodation_ref, field_revision_field_offer_accomodation TO field_revision_field_offer_accommodation;

Then I ran this ruby script to replace all instances of the typo in my files/file/folder structure: https://gist.github.com/dvdsgl/4600317

Then I deleted all caches manually in the DB using:

SELECT
  CONCAT('TRUNCATE TABLE ', TABLE_SCHEMA, '.', TABLE_NAME, ';') AS table_name
FROM information_schema.TABLES
  WHERE TABLE_SCHEMA = 'my-db-name'
    AND TABLE_NAME LIKE 'cache_%'
    AND TABLE_TYPE = 'BASE TABLE'

I am pretty confident I fixed all the typos but I then get an entityreference error.

Am I missing another step here somewhere?


texts: How to use metatags_quick to add no-cache meta tags in D7?

texts:
I'd like to add the following to the meta tags for a single page on my D7 site:

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">

Taken from here

However, when I try to use metatags_quick to accomplish this, it names all my metatags as

<meta name="Cache-Control" content="no-cache, no store, must revalidate">

with the "name=" attributes rather than "http-equiv".  How can add these tags?


texts: How to create 3d charts using Charts module and Highcharts library?

texts:
I want to create 3d charts using the Charts module and with Highcharts as its charting engine (library).

How can I create such 3d charts?


texts: How to create a new parent section on the Configuration page?

texts:
When one navigates to Manage » Configuration, the page is divided into sections which (in the "Seven" theme at least) shows up in individual boxes. These sections have headings like "People", "Content authoring", "Development", etc.
I am able to create a settings form and place this inside any of the existing sections on the configuration page by associating it with the parent key in hello_world.links.menu.yml.
Example:
hello_world.greeting_form:
  title: 'Salutation settings'
  description: 'Configure the salutation message.'
  route_name: hello_world.greeting_form
  parent: system.admin_config_development

This places a link to the settings form for the "Hello World" module in the "Development" section. This is not where I want to place it.
Instead, I want to create a new section named "Examples", place this new section along with the others on the "Configuration" page, and make this new section the parent of my link to the settings form.
Below is an image of what I want it to look like. There should be a new section, named "Examples" as the section heading, and in that section, there should be a link to the settings form with the text "Salutation settings":


texts: After programmatically creating a token, it does not get overridden

texts:
I have the function below in a module. After it runs once, the token never changes again. I have to disable the module, and re-enable it, to get the token to run. Do you have any idea why this happens?

function my_token_values($type, $object = NULL, $options = array()) {
    global $user;

   $rand = rand();
   if ($type == 'global') {
        $tokens['random-number-replace'] = $rand;
   }
   return $tokens;
}


texts:
I'm having a strange problem with the Superfish module. If I go to blocks > superfish menu > configure, I only see Pages, Pages Exclude, and Content Types. There's no other settings. I was somehow able to put the main menu into the Superfish 1 menu, but none of the settings are visible. I have the superfish library in /sites/all/libraries, and the superfish module in /sites/all/modules.

I'm using Navin, a subtheme of Omega.

Thanks for the help


texts: how to disable a class in migrate module

texts:
I have already deleted a migrate class in the .inc file and also deleted it in the .install file but i still get an error saying:

Class ForumTermMigration no longer exists
Class ForumUserMigration no longer exists

whenever i access the migrate UI in drupal site.

how to fix this?

<?php

/**
 * @file
 * Set up the move2drupal module module.
 */

function move2drupal_enable() {
  //Migration::registerMigration('ForumTermMigration');
  //Migration::registerMigration('ForumUserMigration');
  Migration::registerMigration('ForumNodeMigration');
  Migration::registerMigration('ForumCommentMigration');
  }

function move2drupal_uninstall() {
  //
}

function move2drupal_disable() {
  //Migration::deregisterMigration('ForumTermMigration');
  //Migration::deregisterMigration('ForumUserMigration');
  Migration::deregisterMigration('ForumNodeMigration');
  Migration::deregisterMigration('ForumCommentMigration');
}

the above is my .install file. see ive commented the class i deleted in the .inc file.

I have also tried clearing the cache. uninstalling the module and reinstalling it again.


texts: How do I control the "more" link from a views content pane to point to a biblio filtered page

texts: I'm using Drupal 6. I'm trying to create a view pane that lists three biblio items matching a particular term, and then offers a link to more items filtered using the same term. Biblio allows me to access these items nicely using biblio/term/term_name. Is there a way to control the more link provided by views so that it points to this location?


texts: How i can show the value of submitted form

texts:
I have implemented normal form in drupal 7 , and i want to show the value it is retrieve by this functions (submit)

function parkingcalulator_form_submit($form, &$form_state) {

    $parkingType = $form_state['values'] ['parking_type'];
    $totalCost = 0;

    $from = strtotime($form_state['values']['from_date']);
    $to = strtotime($form_state['values']['from_time']);

    $difference = $to - $from;
    $timeInHours = floatval($difference) / floatval(60*60);

    //// if the start time is greater than the end time set the error here
    if ($timeInHours <= 0 )
    {
        form_set_error('$timeInHours',t('Time inserted error'));
    }

    if ($parkingType == 0) {
        // Normal
        if ( $timeInHours < 200 )
        {
            $totalCost = calculateShortTermParkingCost($timeInHours);
        } else {
            $totalCost = calculateLongTermParkingCost($timeInHours);
        }
    } else if ($parkingType == 1) {
        /// Valet
        $totalCost = calculateValetParkingCost($timeInHours);
    }

     return $totalCost;

}

it does not show the value of  (return $totalCost) ,how i can get the value on it


texts: Why I can upload only one file at a time with multi upload widget?

texts:
I have installed the multi-upload widget module to be able to upload several files at once. I have set a file widget to multi upload, which has enabled the ability to choose several files at once however only one files uploads are there any necessary module to install for the module to work ?

Thanks for any help on this


texts:
I have 5 nodes title with some keywords:

this is my node one with some keywords
this is my second title with some keywords
this is my another title with second keyword
this is my another title second keyword
this was my last node title

My search query is: "second title"

when i search with only title keyword, query return 2,3,4, and 5 well, but when i search second title, query return only 2. So, how can i extend my query to return nodes as 2,4,3 and 5 in the last position (since 5 has only one keyword match).

This is my query:

$query = db_select('node', 'n')
         ->fields('n')
         ->condition('n.title', '%' . db_like($_GET['Keywords']) . '%', 'LIKE')
         ->execute()
         ->fetchAll();

Updated:
search keywords can more then 2 words, but query should return as much words matches.

please help!

thanks.