texts: Media: Specify display used for File field on content type's Manage Display tab

texts:
I'm using the Media module (7.x-1.0) to support images and videos. According to the latest best practices I've been able to find, you're supposed to use a File field on your content type to display the media. For example, add a field called "Media" of type File to the Article content type, then use the "Media file selector" widget.

That part is fine, but I'm struggling to actually display the attached file. On the "Manage Display" field for the Article content type I only have four options (shown below). None of these map to any of the display modes defined for File entities (via the File entity module included in Media 7.x-1.x).

I've looked through the issue queue for Media and found some similar questions, with no solutions. There appears to have been a "Media" formatter available for the now deprecated "Media Asset" field type which allowed you to choose which File display mode should be used. This isn't available for the File field type, which is what Media recommends you use.

Has anyone been able to successfully choose a File display mode for a File field using the Media module?


texts: Looping through an array using Migrate Plus

texts:
I'm trying to loop through an array (called "Attributes") in a JSON migration source, but I can't figure out how to do it. Here's a shortened sample of my data source:

[
  {
    "Id": "ST00000002",
    "Title": "Fast & Furious 9",
    "Attributes": [
      "0000000013",
      "0000000015"
    ]
  }
]

My ultimate goal is to check certain checkbox/boolean fields based on those attribute values, but I can't figure out how to handle each of the attributes individually.

Things I have tried so far:

Using single_value and multiple_values
Using the custom Deepen process plugin (as seen on this issue)
Using sub_process
Using the static_map plugin (to do something like this:

map:
    '0000000015': 1
default_value: 0

Using skip_on_value with not_equals: true
Using countless combinations of the above functions

I feel like this can't possibly be as difficult as I'm making it, so I hope someone can help me out. Thank you so much.


texts: Trying to write my own Views filter handler

texts:
Partially as an exercise, partially as a real need, I'm trying to wrap up a views plugin to provide a filter labeled Taxonomy Term: Has children terms - so to allow terms that do/don't have direct children (depending on the option form setting). So far none of my hits was successful, they all ended up in "Broken handler" messages. Most probably because I declare table relations the wrong way.

Looking at how taxonomy.views.inc does it:

$data['taxonomy_term_hierarchy']['parent'] = array(
  // ...
);

I tried:

function taxfil_views_data() {
  $data = array();
  $data['taxonomy_term_hierarchy']['tid'] = array(
   'title' => t('Has children terms'),
   'help' => t('Check if the term has direct children'),
   'relationship' => array(
      'base' => 'taxonomy_term_data',
      'field' => 'tid',
      'label' => t('Has kids'),
   ),
   'filter' => array(
      'help' => t('My Help'),
      'handler' => 'views_handler_filter_taxfil',
    ),
  );
  return $data
}

I am also unsure about the parent class of the filter handler to extend, but at this point I'm close to thinking it does not really matter, as there is bigger problem in front of it.

Usually the example/tutorials base on own tables that a module creates, whereas mine has to re-use the existing.

Could anyone point me to the right direction?


texts: I have created view which displays a list of nodes. I made a custom module with a function which calls db_query() to delete the specified node in the list. I made a Global:Custom Text  field in the view which I made into a link to point to that function. The link works perfectly, the node is deleted from the database table, but now the view still lists a blank line (where that node used to be) which still has the Global:Custom Text field there. How can I get rid of this line completely?


texts: How can I create a Simple page that display the latest node of a content type?

texts:
I write a little module for loading the content via ajax(one of the used tutorials) and now I need a page for the first visiting(front page). I don't want to do this with Views and looked around, but didn`t found a simple solution for this.

So, I extend the hook_menu () function with:

EDITED

$items['first-node'] = array(
  'page callback' => 'first_node_callback',
  'access callback' => TRUE, //EDIT -> 'user_access' creates Menu error
  'type' => MENU_CALLBACK,
);

and the callback:

function first_node_callback() {
  $query = db_select("node", "n");
  $query->fields('n', array('nid'))
    ->condition("type", "mytype", "=")
    ->orderBy("created", "DESC")
    ->range(0, 1);
  $nids = $query->execute()->fetchCol();
  $nodes = node_load_multiple($nids);
  return node_view_multiple($nodes, 'full');
}

EDITED END

Should i load this in the #markup or use a normal return or need i an extra theme output? I'm little bit confused with the possibilities!


texts: Programmatically update or add a user's avatar

texts:
I'm trying to update the user avatar in my custom module. Which method shall I use to update the image in db as well as to move the file to public directory?

Thanks.


texts: Filter product displays by parent taxonomy term

texts:
I'm running a music store and have a taxonomy term field on products that that is used for the product's format. We tag the products from the following vocabulary.

Vinyl

140g vinyl
180g vinyl

CD

Jewelcase
Digipack

Digital

Mp3
FLAC

I'd like create an exposed filter on the product catalog using the parent terms, Vinyl, CD, Digital. When one of taxonomy terms is selected, the filter should display all products tagged with the child terms.

The Content: Has taxonomy terms (with depth) filter doesn't seem to work with referenced products. I'm not seeing a solution in the Taxonomy Entity Index module either (but I might be wrong).


texts: How to store additional_settings value when adding a node?

texts:
Since storing node type additional_settings is done without the need for calling any other hooks, I quite have a problem to store a simple string from additional_settings on node add form.

After the admin enables a feature on the node type form he/she is offered the following form when adding a node:

$form['MY_MODULE'] = array(
  '#type'         => 'fieldset',
  '#title'        => 'Custom String',
  '#collapsible'  => TRUE,
  '#collapsed'    => FALSE,
  '#weight'       => -99,
  '#group'        => 'additional_settings',
  '#attached'     => array(
    'js' => array(
      'vertical-tabs' => drupal_get_path('module', 'MY_MODULE') . '/MY_MODULE.js',
    ),
  ),
);
$form['MY_MODULE']['MY_MODULE_string'] = array(
  '#type' => 'textfield',
  '#title' => t('Enter a string'),
  '#default_value' => '',
);

I've seen other modules, like comment.module or nodeapi_example.module where they then call hook_node_insert() and I tried that as well. I happily can see my string within dpm($node), but then I'll get a PDOException: SQLSTATE[42S02]: Base table or view not found. Do I have to follow any naming conventions on how to name the table? Or do I have to create it first (where)?:

db_insert('MY_MODULE_string')
->fields(array(
    'nid' => $node->nid,
    'vid' => $node->vid,
    'string' => $node->MY_MODULE_string,
))
->execute();


texts: How can I hook into an entityform? So that i could create a custom dropdown which is populated from a database

texts:
I am trying to create a custom Dropdown which is populated form a database but I'm not getting which hook to use and how to use it.
My module name is "entityform" Plzz Help Thanks :)


texts: Passing variables to JS from theme folder .tpl files

texts:
I use many template files in my modules via hook theme. In order to pass variable to JS files I use the method described here:
https://www.drupal.org/node/304258
in the .tpl.php files:

$my_settings = array(
  'basePath' => $base_path,
  'animationEffect' => variable_get('effect', 'none')
);

drupal_add_js(array('myModule' => $my_settings), 'setting');

and then in the .js files:

var basePath = Drupal.settings.myModule.basePath;
var effect = Drupal.settings.myModule.animationEffect;

For the first time (it seems) I'm trying to pass variables to JS from .tpl files located in my theme folder.
Suppose I have a content type called 'cars',  I craete a page-cars.tpl.php template file in my theme folder which automatically applies to all car pages. But in these tpl files I can't pass variables to JS using the method described above.
I tried switching 'myModule' to 'myTheme' but Drupal won't recognize it as a defined setting

As per Clive's instructions I added to the my_theme_preprocess_content_type(&$variables) function and it works! (thanks Clive)


texts: Why adding '--create-db' to sql-sync command throws the access denied?

texts:
The following command works without a problem:

drush sql-sync @alias1 @alias2

If I add "--create-db" I get:

ERROR 1044 (42000) at line 1: Access denied for user

Why might I be getting this error and what might I need to change? Do I need to add additional details to my alias file?

Also, is it correct that this is the best way to make sure that there aren't tables left over in @alias2 that have been removed from @alias1?


texts:
Drupal 6 had an easy way to do this, but D7 doesn't.
I asked this question on the drupal.org forums, and I didn't get answer. Am I asking too much? I just want 2 level tabbed main menu where I can have full control over the link styling.

Bottom line, I want to extract each individual link (and sub link) from the main menu and theme them individually.


texts:
I have this node that belongs to a group, and I want to get the group ID of that node, to print it, something like $node->nid; but with the group id.

Is that possible?


texts: Displaying a text field for the user to embed media, and then enabling rating (fivestar) for that content; listing all of them as separate writings

texts:
On a given site's page, which is supplied with the "casting" URL alias, I would like to show some embedded videos with a description field, which users have uploaded (embedded) via a simple text field that Embedded Media Field processed. These would appear as separate writings, signing the user who uploaded this stuff.
There would also be a rating/voting opportunity (fivestar, thumbs up/down, etc.) with the help of Rate or Fivestar module (which one do you suggest?!) to let users vote for the embedded video.

When someone logs in, I would like to show the form which helps embedding (or a link to this form) at the top of the page, and below that, there would be the embedded media from the different users.
So the form would be as simple as that: containing a text field, in which e.g. Youtube URLs could be copied (it would be processed by Embedded Media Field module) and a description textarea to write about the embedded stuff.
The result output would contain these: the embedded media, the description, who this post created and when, and a rating/voting opportunity (five stars, etc.).

How could I do that? What do you suggest for creating a form like that?
Maybe it's not too difficult, but I didn't find the perfect solution, and I couldn't restrict content types to these fields (and with the help of Webform I couldn't add a field of Embedded Media Field).


texts:
My site is in English and Spanish.
My question pertains to the Similar by terms module and a custom view that on click shows random filtered by term nodes. How would I create an argument to show Spanish content when in Spanish mode, and English content when in English mode? I realize that I could simply filter nodes for Spanish.
How does the Similar by Terms module recognize the fact the page is in either English or Spanish, and display the appropriate language on click?


texts:
A form was created with codes in a custom module, with three items that must be filled. After submission, the code will do it's magic and return the result on the same page, below the form.

I'll like to have the form alone in a block so that it can be placed anywhere on the websites and when filled from there, it will redirect to the main page and show the results.

I don't know which way to go please.


texts: Where is $page['sidebar_second'] rendered? I want to edit the style of the  listing of the recent comments

texts:
The comments in the block recent comments is styled with an unordered list. I want the points of the list beginn exactly under the N of New Comments.

Google Chrome tells me that there is a padding-left: 40px; attribute:

I do not know from where i get this attribute. I looked in my themes css files but there is no attribut padding-left: 40px;

Here is the element lookup in Firefox:

I need to set the padding-left attribute to exactly 15px. This is how it should look like:

I'm using the mas Theme in markapot.

Can I define the style of the ul in the function $page['sidebar_second']? If so, where is the sidebar built?
Thanks for any help!


texts:
I am trying to convert html to Drupal 7 theme.

function theme_menu_tree($variables){
  return '
' . $variables['tree'] . '
';
}

simply returns the entire menu how to make it like following

Item

Link1

Link2


texts:
Is it possible to create a form element of type markup and add a state to it, to make it visible on a condition? I can't seem to make it work and get the error:
Warning: Undefined array key "#type" in Drupal\Core\Form\FormHelper::processStates() (line 211 of core/lib/Drupal/Core/Form/FormHelper.php)
I need to just add some text in the form and make it visible on a condition.
Any help would be appreciated, thanks!


texts: How to get feed title in correct language?

texts:
In Drupal 8.2 I have rss default feeds on front page and feeds on my views.
On the bottom of the pages I can click on the feed icon to open the feed page.

On the feed pages the feed titles are not in the correct language. The feed titles appear always in the language the node was created.

But I need the correct language for the feed title when switching to another language on my drupal site (/en/..., /fr/....).

And the feed title links to the wrong language.

How can I repair this problem in Drupal 8.2?


texts: How can I check if the author of the current node is the current logged in user?

texts:
I am trying to execute a Rule based on the condition of whether the currently logged in user, is currently viewing their node (a node they are the author of), or viewing someone else's node. The Rule event/trigger I am using is "User saves a Status" from Statuses module. Next I have used the Rules condition "Execute Custom PHP code", and set an if statement that checks whether the current node uid (the uid of the node's author) equals the current user uid:

if ($node->uid == $user->uid) {
  return TRUE;
}
else {
  return FALSE;
}

This is causing a bunch of "Trying to get property of non-object" errors, as both the $node and $user variables are not being recognised. I'm not sure why this is the case, do I need to use the node_load() and user_load() functions before using these variables? If so how?


texts: Leave Page Alert "warning " Unless Submit Button Clicked

texts:
I have a website where users submit application forms. The form is based on Entity forms.

How can I popup a message "warning" if user try to close browser without submitting the application.

something similar to this http://jsfiddle.net/DerekL/GSWbB/show/

Many thanks,


texts:
I used a form controller to store an image in configuration settings. Like so.

public function buildForm(array $form, FormStateInterface $form_state) {

$config = $this->config('custom.settings');

$form['icon'] = [
   '#type' => 'managed_file',
   '#default_value' => $config->('icon'),
   '#upload_location' => 'public://',
];

}

public function submitForm(array&$form, FormStateInterface $form_state){
        if (!empty($form_state->getValue('icon'))) {
            $image_fid = $form_state->getValue('icon');

            $file_name = File::load($image_fid[0])->getFilename();
            $file_url  = '/sites/default/files'.$file_name;

            $file_uri = File::load($image_fid[0])->getFileUri();
            file_save_data(file_get_contents($file_uri), $file_uri, FILE_EXISTS_REPLACE);
            $this->config('foundation.settings')
                 ->set('icon', $form_state->getValue('icon'))
                ->save();

            $file       = \Drupal\file\Entity\File::load($image_fid[0]);
            $file_usage = \Drupal::service('file.usage');
            $file_usage->add($file, 'Standard', 'file', $image_fid[0]);
        }
}

I then attempt to grab the file in my .theme file to be used in twig templates like so

function AAEP_foundation_preprocess_page(&$variables){
    $variables['icons'] = [
        'icon1_file' => \Drupal::config('foundation.settings')->get('icon'),
    ];
}

I then use {{ icons.icon1_file[0] }} in my template but it only produces the file ID rather than the actual url to the image. Also after searching through sites/default/files I can't seem to find the images that were meant to uploaded so I'm concerned that the files were not actually saved. How would I get the URL based on the image id? Also is there any issue with how I saved the file in submitForm()?


texts: Custom module menu path renaming/redirection

texts:
Is it possible to create path like subdomain for custom module menu?

For example create url like xyz.example.com if path is example.com/xyz where xyz is custom module menu.

I've already tried to use .htaccess file

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
RewriteRule ^xyz(.*) http://xyz.example.com/$1 [R=301,L]

It correctly changing url from example.com/xyz to xyz.example.com but xyz.example.com redirected me to HOME page of the site.

I just want to change the url from example.com/xyz to xyz.example.com where module result will be displayed.

Thanks.

EDIT : My requirement is similar to this


texts: Scald : How to add several medias to a node using entity metadata wrapper?

texts:
I'm looking for a solution to my problem that is pretty simple in fact.
I'm on an importing task in which I have to create programmatically a node and then populate all its fields.

As we're using the Scald module, we can add several medias to a node. But I can't figure out how to associate several medias to a node ?

I tried the following :

foreach ($file_atoms as $i => $atom) {
    $node_wrapper->field_atom[$i] = $atom->sid;
}

or :

foreach ($file_atoms as $i => $atom) {
    $node_wrapper->field_atom[$i]->set($atom->sid);
}

But I get the following error :

  Error: Cannot use object of type EntityDrupalWrapper as array

I followed the doc on this page but it does not seems to work..

Can somebody help me ?

I'm encountering the same problem with taxonomies : I'm not able to set multiple values to the node wrapper.


texts: Views exposed filter combining several text fields into a dropdown with a field

texts:
I am searching hi and low for a solution in Drupal 7 Views 3.x that will allow me to combine several text fields into one dropdown with a text field beside it.

From...

To something like this...

The content type is Film containing...

Title
Body
Artist node reference

Note I don't or can't use the Global:Combined field option since this does not indicate what areas a person is searching, and in our case we need people to be able to narrow down results based on areas they are wanting to search.


texts: Is it possible to change the text-format (display output only) of a long-text field through the theme in Drupal 7? Similar to the way you can override the imagecache output for an image. The reason I don't want to change the database value is because the user role doesn't have permission for the desired output (full_html), but I'd like to have this output on a specific content-type - benefit 2 is that the user doesn't have the input/text format options on the form.


texts: How do I create and set fields in multiple nodes using a rules loop

texts:
I have created a RULES loop.  It loops over a set of flagged nodes (using the action 'Fetch Node flagged by user') and attempts to create a new node for each flagged node.  Finally, the new node is linked to its related 'loop' node via entity reference.

My problem is:  The action that creates the new node ('Create a new entity', which is called within the loop) assigns the new node to a static variable name (mine is: entity_created).  Because of this, the loop only creates one new node and only saves data from the final loop node into it.

Is there a way to either create this variable dynamically or is there a way to reset the value of entity_created so that it can be used to create multiple nodes?


texts: Drupal 7 Views Chart Statistics Over Time

texts: I want to create a View of node requests/views over time. The problem is grouping the Access log timestamps (minute,hour,day, etc) so that these are chartable. Does anybody know of a solution for this in Drupal 7 Views 3?


texts: Using one view for multiple Content Types

texts:
So I have four content types in each there is a field called offer, I intend to make a view to display all nodes of those four content types with offer value equal yes.

I have tried the following: I have made a view of the four content type and add the four fields as filters and make a new filter group but I can not separate content types so that I can group each content type with its field.

Is my approach right? What do I need to do?

Thanks in advance!


texts: What's the theory behind missing links in navigation?

texts:
I know a lot of thinking has gone into D8's admin menu, but I'm clearly missing something. Some links don't seem to feature anywhere in the interface, and there seems a lack of consistency between bundle, entity listing and entity adding:

e.g.

Taxonomy seems to be complete: there's a link in the admin menu to admin/structure/taxonomy and from there you can see the bundles (vocabularies), list the content (by bundle) or add content (in the drop-down link for the bundle).
Nodes ("Content"): there's an admin menu entry for listing content, and one for content types, but there's no Add content item, either for node/add or for node/add/foo Are users expected to know to type this?
Custom blocks: There's an admin link to the types of block, but no links to either the listing (/admin/structure/block/block-content) nor the links for adding any blocks?
Menus: If a menu has no items there's an add item link on the listing page. Once you've added one item there is no link on the listing page (but you can still find it on the listing-of-menus page in the drop-down)

I realize I could make my own menu (e.g. I could manually add these missing links in where I want them, or I could use another module like shortcuts) but it feels like I shouldn't have to as these basic systems are unusable without internal technical knowledge about likely paths.

As I say, I know a lot of clever people have worked for years on D8, so I'm assuming I've missed something, or have something wrong with my D8 install?


texts: How to convert field labels to search boxes in views

texts:
I have a requirement where I need to convert the labels of specific/all fields of a view to search boxes on user click. The search box will be an autocomplete field.
Here, say for eg. the label TITLE gets converted to a search box on user click and provides suggestions(from the title field) as the user types characters


texts: How to use Drush with Apache Directives?

texts: My Drupal installs are set up with apache environment variables/directives (SetEnv DB_NAME somedb) to store the database name, username and password. It appears that Drush isn't able to use these by default as it fails to recognise the apache directives. Is there another way of doing this or can I use some kind of alias or something else to pass the database credentials directly to Drush?


texts: How I can change path from /comment/reply/11#comment-form to /node/$node->nid/#comment-form in node $links?


texts: Why has not Pressflow been upgraded to 6.24?

texts:
Two weeks ago, Drupal released 6.23 to fix a security vulnerabilities, which was followed from Drupal 6.24. However, Pressflow is still in 6.22 (although, there are some files have been changed at the last week).

I am wondering whether Pressflow 6.22 has not been affected by the vulnerabilities in Drupal 6.22, or it does but it takes time for the team to upgrade it. If so, how insecure is Pressflow 6.22?


texts: create two different registration form with same fields without using profile2

texts:
I have already setup account fields, and I have two roles (A) and (B)
I need to create a page with two button links :

register as (A)
register as (B)

when the user choose one of these two links, he will go to the registration page
and after filling the form, he will be registred and automatically get the role (A) or (B) pursuant the link chosen above

the problem is: how can I pass the info of what choice the user has chosen (first or second link) to the registration form.

I thought to pass it inside the request URI and then get it via $_GET but Is there another solution wihtout showing any query to the user in the URL ?

Thanks in advance.


texts: how to setup blocks that differentiate 'node edit' case from 'node add' case in MULTISTEP forms

texts:
Im using Drupal 6 and the multistep module :

I need to display informations in a block apart when my users wether add or edit some of the available multistep forms :

. there's a block that shows up with an EDIT title when EDITING an existing node with information within it for this case :

only shows up when :
node/*/edit* page

. there's a block that shows up with a CREATE title when ADDING a node :

only shows up when :
node/add/multistep-content-A*
node/add/multistep-content-B*
node/*/edit*

node//edit is necessary for ADDING since when the user finishes the first step of the form, the node is saved and the link which was node/add/m-c-A turns into node/nid/edit.

in both block I use a bit of php ( url arg(), $node) to check content type, to retrieve node info if exists, to decide wether show info for ADDING cases or for EDITING cases. (as there's nothing to show, the entire block DIV does not show up)

I would need to recognize the ADDING case after step 2 of the form...
when the node is created but when the progress bar is lesser than 100%.

in other words, to retrieve the 'completion status' argument from the multistep module, the one that tells the progress bar if the form is completed or not.

it appears it's not in the $node array.. ?

EDIT : found a trick, see comment 2.


texts:
I have an odd bug that isn't on other drupal install for other domains on my server.

Basically, menus work fine.

However links in the content will look like this:

https://example.com/content/content/node/123

instead of this

https://example.com/content/node/123

which is how it should be.

Interestingly enough this persists in using the l() function in Drupal 7 templates or in views even if I use rewrite output.

This doesn't happen on another Drupal 7 install with a different domain and web directory. I've changed base_url in settings.php and it does nothing and RewriteBase in .htaccess and it does nothing. I flushed all caches. I even changed to a basic theme. None if it made any difference. I'm stumped and about to resort to outputting variables from core. Any help?

With the duplicate sub directory in the URL, or without it, confusingly enough, the node does display and everything works. What is going on?


texts: When I double-click on the publish content tab on a node, I end up on /user instead

texts:
This is on a pretty complex site so I have no idea where to start looking for the cause of this behavior.

I have installed the Publish Content module, which creates a little "publish" or "unpublish" tab along with "view" and "edit" on each node, for users that have permission to publish or unpublish content.

When I click on "publish" or "unpublish" once, the expected behavior follows. But if I double-click on that tab (and only that tab – others don't do this), then instead of reloading the node, it takes me to my user page.

I tried disabling the devel module but that didn't help. It happens on multiple content types, and as multiple different users with different roles, including user 1.

I have a couple of rule-based redirects in place, but they're only for specific roles and they're only triggered on particular actions (such as login). And none of them redirect to the user's own page.

I have no idea where to start debugging this.


texts:
For example a filter form on admin areas can best be GET forms, that way they are bookmarkable and can filters be maintained across pager-pages.

How can one best use form_api for such forms? Will the _validate hooks be submitted? Can the _submit hook be omitted?

For example views-exposed filters work this way; But the code in views handling this is convoluted and complex, too complex to be used as good example for when developing custom interfaces with simple filter forms.


texts:
I want to use the email_auto_login module. However it implements a hook_mail_alter which I don't want.

/**
 * Implements hook_mail_alter().
 */
function email_auto_login_mail_alter(&$message) {
  $user = user_load_by_mail($message['to']);

  // Don't add tokens for admin, anonymous or blocked.
  if (!isset($user->uid) || $user->uid == 1 || $user->status == 0) {
    return;
  }

  $token = _email_auto_login_generate_token($user);

  foreach ($message['body'] as &$body) {
    $body = _email_auto_login_add_token($body, $token);
  }
}

Is there a way to remove the hook without modifying the above code? I'm running Drupal7.


texts: How to add registry key verification step with the key being stored in another database

texts:
I am currently learning how to use Drupal through Udemy classes; I am a complete newbie.

I am building a Drupal Website, for my personal development, and when someone wants to register to the website I want the to fill in the typical form: full name, organization, etc (stuff like what Facebook for example asks). However, I want to add one extra identifier: registry number. What I really need to know is how to make this secure; so that when you type in a number; if it is not correct or it is random, then it would not allow you to register (sounds like the CD keys old PC games had).

Typically, those registry numbers are within the government ministries (say for businesses registries). For example to make taxes you have a registry key, i think that is how it is called; then when you do your taxes online you add that key to verify it is you. But how does the system know that key you entered is correct? It must be connected to a database that has all this information stored.

How do can I make this happen for my drupal website? But is it also feasible? (it must be right?)


texts: Need way semi complex way to display author posts in views

texts:
So I have an interesting request and I'm hoping some of you guys here might know a decent way to solve this.  On one of our homepages we have a block that shows current authors posts.  This was a simple view that just showed authors posts sorted by date.  However now they want something a bit more specific detailed below.

In stead of just random posts, the first request is that is shows 5 post but of each post they should all be a specific author and NOT repeated in any way.  For instance you have Author A, B, C, D , and E.  The view would look like this.

A = His/her latest post

B = His/her latest post

C = His/her latest post

D = His/her latest post

E = His/her latest post

So each highlighted author shows their latest post and none of those authors repeat.

The next thing they want is an ability to pick and choose WHO those top 5 authors will be.  So one week it might be A, B, C, D, and E; but they next week it could be F, A, H, J, and Y.  This seems like a fairly complex view and not to mention the interfaced required for the UI portion.  Thoughts?


texts: Deploy block and block configuration to production instance

texts:
My clients create content and blocks in a staging environment (this is mandated by client) and then we use Deploy with Auto Deployment Plans to send the content over to the production server. They create a lot of blocks for different purposes and on the fly.

With Deploy (and UUID), while we are able to get the block copied over from staging->prod, the configuration of the block does not get transferred over. The client must login to the production environment and configure the block settings as an extra step. Is there a known way to copy over block configuration using Deploy (that is reasonable for a client with minimal Drupal knowledge)?


texts:
I would like to implement something like the second example in this link but not when the form is submitted, actually when a radio button is clicked. (click to alert) http://d7.drupalexamples.info/examples/ajax_example/advanced_commands. With the code below i managed to alert the message but after that the form does not work properly, after the submit it redirects me to $base_url/system/ajax and a json array is displayed.

$form['submitted']['test']['#ajax'] = array
        (
           'callback' => '_test',
           'wrapper' => 'nimportequi',
           'progress' => array('type' => 'throbber', 'message' => '')
        );

and the callback:

function _test($form, $form_state){
    $commands = array();
     $text = "";
     $alert = 0;
     if (valid_email_address($form['submitted']['email']['#value']) !== FALSE)
     {
        $result = user_load_by_mail($form['submitted']['email']['#value']);
        $text = ($result !== FALSE)?$alert=1:"Based on your email, you are not a member yet!";
     }
     else
        $text = "Based on your email, you are not a member!";
     if ($alert != 1 && $form_state['values']['submitted']['member'] == 1)
     {
        $commands[]=ajax_command_alert($text);
       // $commands[] = ajax_command_data("#foo", 'label_radio', '1');
     }
     $form_state['rebuild'] == TRUE;
     return array('#type' => 'ajax', '#commands' => $commands);
}

Also i am using a rule when the form is submitted. What am i doing wrong ? I cannot figure it out…


texts: How can I do a custom form redirect on the user registration form?

texts:
I added a custom submit function to the user registration form. I want to be able to redirect to the user profile edit. How can I get the uid of the record that is about to be created? global $user doesn't work:

function my_user_register_submit ($form, &$form_state) {
  global $user;
  $form_state['redirect'] = 'user/' . $user->uid . '/edit?registration=1&destination=blahblah';
}

Edit:

My use case is this: after registration I want to redirect the user to the "edit profile" page to complete the remaining profile fields. When they "skip" that or complete the form they go to their profile page.
However, when a ?destination parameter is passed into the register form I want to carry that value to the "edit profile" page and then direct the user to that destination page when they are done.


texts: How to get image url in a twig file from a media entity

texts:
Normally I am able to get an images url by setting the display setting for that field to url and then writing something similar to this in order to print the url

  {{ content.field_image.0['#markup'] }}

However this is not possible in the display settings for a media entity, the only options are -

Rendered entity
Entity ID
Thumbnail
Label

So my question is how to get the url from the image, as I need to use the field as a background image so can't just render it out as normal.


texts: How to set the front page with Mobile Switch

texts: I am using Mobile Switch to switch to my mobile theme when viewed on a mobile device. However, I don't see any way of setting redirect to a custom front page. How can I do this?


texts: How do I alter the behavior of the form fields contained within the paragraph field?

texts:
Using the Paragraphs module in Drupal 8, I am attempting to alter the behavior of the form fields contained within the paragraph field. This is so I can add behavior like AJAX callbacks, hide show other fields using states etc.

I can access the paragraph parent field using this function:

function hook_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
}

But how do I access the fields inside the paragraph?

I have tried hook_field_widget_form_alter but to no avail.

How do I do this?

Note: I am still quite new to Drupal development.


texts: Creating a view of content that is filtered by the email of the current user

texts: How can you create a view of content in a specific node type where there is an email address that will correspond with the email address of currently logged in user's email address? The content is not owned by user. This view will be used to assign relations to the user and other content with rules.


texts: Add ability to add bundles to an entity that does not currently have bundles?

texts: If you have a custom entity that does not create bundles, is it possible to modify it to allow new bundles to be created?


texts: How to change display suite extra default permissions?

texts:
I am having problems with diplay suite extra module.

Every time I create a dynamic field, it only shows up for logged in users.

So I have to manually go to permissions, look for the content type, can change to anonymous users.

This is highly annoying and wastes a lot of time.

How can I set permissions for ALL content to be view able by anonymous users.

My website is not private, I need all content to be available publicly, by default!


texts: How to implement grouped filters filtered by roles?

texts: Is it possible to make exposed grouped filters where some filters are only available for certain roles?


texts: HybridAuth: How to bypass 'allow access' button

texts:
I have installed HybridAuth module to login in LinkedIn.  The following is the url through which user can log in from Popop window.

  http://www.mydrupal.com/hybridauth/window/LinkedIn?destination=node/38&destination_error=node/13

The logged in window gives 'allow access' button each time when open a popup.

Question:  How to bypass this 'allow access' button after the first attempt? I have already gone through various links but could not get proper idea.

Screen shot is as follows.


texts:
I am creating a search api view based on Search API (with Database backend for now (will change to solr later)).

I have 2 entities that are being indexed i.e. project and client.

A project contains a projectnumber and an entity reference to a client. The client contains a firstname and lastname.

I have added a view that shows the projectnumbers and (via relation to client entity) the first and lastname.

I want my exposed fulltext search to search these 3 fields (projectnumber, firstname and lastname).

The weird thing is that he only seems to search on projectnumber and not the first and lastname.

Does anybody have a workaround/solution for this?

Thanks in advance!


texts:
I would like our website can register right.
Such registration is: After the user fields to fill out the registration page to enter paid. If payment was successful record in the user database is placed.

These payments are: When users get paid by the banks a record is submitted to my site.
This must be paid to confirm a few fields of this record to send back to the bank.


texts:
I review my module code with http://pareview.sh and it returns an error:

Line #94 - ERROR | Parameter comment must be on the next line at position 1

/**
 * Fetch node object properties. //<---  THIS IS LINE #94
 *
 * @param object $node contains information about campaign.
 *
 * @return array
 *   Webform properties.
*/

http://pareview.sh/pareview/httpgitdrupalorgprojectbounceconvertgit

If I add the comment on next line, it says: it requires a blank newline after it.
How to fix this error?


texts:
How can I use my native calendar in Drupal?
I set Drupal to use Farsi and set Asia/Theran as default location, but the month names and years are still from the Gregorian calendar, even if they are translated in Persian.

Is there any coding method to use a calendar that is not the Gregorian one?


texts: When updating or creating a node of a specific type, I want to save a PDF version into files

texts: I have a node of a particular type that I would like to save as a pdf file (using Entity_print) upon creation or update (whenever a content is saved). The issue I am running into is that some of the variable data used in the template is determined in the preprocessor but the preprocessor has not yet been run at the time. I have a PDF view mode and corresponding templates. When I enter something similar to http://example.com/print/pdf/[entity_type]/[entity_id] I get exactly what I want but that's just at run time. I need this setup 'behind the scenes' and saved into the files. I can generate the pdf file but it is missing the preprocessed variable data. Is the only way to get variable data into twig via preprocessor? Is there a hook that will do this? I have played with a few of them but none seem to be able to capture the variables for the twig templates. By the way I do not want to override the regular preprocessor theme which will be used for page rendering.


texts: Why is Drupal with redis slower than mariadb?

texts:
I've got a big Drupal site running Commerce, with cloudflare caching static resources, maybe 20K users or more per day.

MariaDB caches about 500mb worth of queries, we're running freeBSD with php56 and php fastcgi. I'm using the redis PHP extension.

When I turn on redis for all the cache tables, I see the php-fcgi processes start to spike from 7% CPU up to about 35% and load goes through the roof.

Tried it a couple of times, which would minimize cache stampeding, but still I'm somewhat confused as to why redis is performing so poorly.

I've read through redis.conf and the main change I've made is not to snapshot the db to file.

I can connect with redis-cli monitor and see tons of cache data passing through.

Any ideas about what's happening here?

Thanks!


texts: Creating Pay and Configure Products on Drupal Commerce

texts:
I am using Commerce Product Option (https://drupal.org/project/commerce_option) module to create a customisable product.

I want a way in which the user can checkout and make payment for the product and then be allowed to customise it. What would be the ideal set of Rules for this scenario?


texts: Configuration management with different database and websites

texts:
We have a central code base (Git repo). From this code base we deployed several websites already.

Till now we used features. The websites which are already in production they have a filled database with a lot of content.
From now we switch over to drupal 8 Configuration management.

In the central code base we have set $config_directories[CONFIG_SYNC_DIRECTORY] = 'config/base';. This directory contains all the configuration, from where we deploy our new added configuration, after a drush cex -y.

But after I do:

first a new install off the site with Configuration installer module and import all the existing configuration, everything works fine. I can import and export configuration without problems
but then I have to copy the production database (from the site which is already in production) back into this database. After that I am not able to import configuration anymore.

But I need to copy this database back in, because we need all the content from the existing site (which was based on Features)

I get an error the UUID is not matching etc... Is it possible what I want? And how do I get it working?

(I tried already manually copy/paste the correct uuid: in system.site.yml, but it still didn't work).

Update:
I use docker for my local Drupal 8 environment


texts:
I updated my Drupal site on my local version, and everything went fine. When I synced my live version, all of my Views that are pages (not blocks) are missing. I manually went through the database, and it looks like their entries are still in there, but they don't show up on my Views page. I don't know if this data is incomplete or corrupted, though.

I know I could re-create the Views manually, but the better solution seems like it'd be to fix/restore the original missing Views. Is there a way to debug this? The PHP error log doesn't show anything.

Update: List of missing Views:

Comments
Content
Custom Block Library
Files
Frontpage
Media
People
Taxonomy Term
Watchdog


texts: add variable to process_page($vars) in form function

texts:
Is there an option to change $vars array in form function? I would like to pass some variables to page template in form creation function .. If not, what are other options to influence page.tpl from form?

EDIT:
I have a function for form creation and i would like to add page class if some params are sent to this function.

function mymodule_test_form($form, &$form_state, $param){
  if ($param == 'special'){
    #add class to page
  }
}

thanks!


texts: Is it possible to change the tab order of MENU_LOCAL_TASK items on a given page?

texts:
I have created a couple MENU_LOCAL_TASK items for my advanced search page in Drupal 6, but they appear at the end of the tab list on the far right. I would like my new items to appear first in the list of tabs.

Is there an easy way to accomplish this? I tried setting the weight of my new task items to -99 but this appeared to do nothing.


texts: Possible display options in Drupal views

texts:
I am a newbie into Drupal 7.
I am learning D7 views. I exported a view and found :

$handler->display->display_options['access']['type'] = 'perm';

with no permission array to specify the user group who can access this view.
Which user group does it take by default?
Also, in my custom view in code I have replaced it with following:

$handler->display->display_options ['access']['type'] = 'role';
$handler->display->display_options['access']['role'] = array(
    3 => '3',
);

It is working fine. I want to know all possible values of $handler->display->display_options this array. Where can I find all these options? Is there any documentation available for this?


texts: Why is an untranslated string not showing up?

texts:
In my module I have some custom strings. I use these in the t() function.
When I go to admin/config/regional/translate/translate and filter the untranslated strings my custom strings do not show here.

What could be going wrong?


texts: How to pass a custom object from a page to another page through a route or other means?

texts:
I want to be able to pass a custom object of type FormMode through a route or any other way.

My custom.routing.yml file is:

custom.page:
  path: '/custom/{model}'
  defaults:
    _controller: '\Drupal\custom\Controller\CustomController::page'
    model: ''
  requirements:
    _permission: 'administer site configuration'

My FormModel class looks like:

class FormModel {
  public $name;
  public $area;

  function __construct($name, $area) {
    $this->name = $name;
    $this->area = $area;
  }

I create an instance of the object and use Drupal URL function like shown below:

$model = new FormModel('name', 'area');

Url::fromRoute('custom.page')->setRouteParameters(array('model' => $model));

but Drupal throws an error saying Drupal cannot convert a object to a string which I understand it cant convert object to string.

What would be the best practice to pass a object through a route or pass object created from a form into a controller? I dont want to create an entity as I would then need to update the database with the new fields.

Thanks


texts: How to override base url when creating links to public files?

texts: I need storage the upload into drupal file in another server and I need change public path to files to example http://server_with_image/image How I can do this?


texts: Change module from manual to composer installed

texts:
Note: This is not a duplicate of The site has a mix of modules installed manually and via Composer: Can I move all to Composer?
As this question below involves different folder locations.

I currently have modules installed via the Drupal UI (/admin/modules/install) which have installed in the directory /modules.

And I also have composer installed modules which are added to the directory /modules/contrib

Task: To move modules over to Composer managed.

I have run "composer require drupal/MODULE" which has put the module in the /modules/contrib location. But now there are 2 copies and upon refresh & clear cache, Drupal is still using the old module location. (I can tell as the composer installed module is a newer version)

I would prefer not to have to uninstall all the modules that need moving as it can cause issues.

I have tried just removing the module from directory /modules (leaving the new composer installed module in modules/contrib), but I get the WSOD.

Question: How do I switch modules over to Composer managed with a different directory location?


texts: How to get block and views results to display in the search result page?

texts:
I'm using Drupal7 default search for content(node). For some pages I have integerated drupal blocks and view blocks. While searching for specific string in search which are available in blocks are not showing up in search result.

I have verified that the content in the site is fully indexed (100%), still the texts available in the blocks are not returning any results when searched.

I have also tried the Search by Page module, it doesn't help either. How can I make every page in the site to be indexed and display results when queried for?


texts: Can you filter nodes in a view by the last date of one node referencing that node

texts: So I have two content types Tours and Concerts. Concerts has an entityreference field that references a tour. I want to filter a view of Tours and only show tours that still have upcoming concerts. Once all concert in a tour are over I no longer want to show the tour. Is there a way to do this? Could you use hook_field_extra_fields to calculate the date and then somehow filter by that value in views?


texts: Redirect to the front page with a different language

texts:
i have a question about redirecting to a page with a different language. I found this old post for drupal 7 but I doesn't really help me - https://www.drupal.org/node/1280468

Now we are in Drupal 8 and the redirect works like this:

return new RedirectResponse(\Drupal::url('<front>'))

But how can I set the language for the redirect? In my code I have the languagecode like NZ for New Zealand.


texts:
I have form built with form api in Drupal 8,
now, i want to show an image and some text description on top of that form, meaning, before the form is rendered, what i can think of is, doing a node_load and then suffix and prefix with the node_load value or entity load,
but my question is, in case i write a function for node_load or entity_load, where would i call the return value of these functions and how ?
i am thinking of something like this :

$form['image_div'] = array(
            '#prefix' => '
',
            '#suffix' => '
',
        );

how can i call the path to image here, which is a function return value.


texts: Display a (view) block for everyone except one role

texts:
I have a block which has been generated by a view, and would like to show this block to all users except people who have been granted a particular role, is this possible, and if so how, exactly?

Many thanks in advance.

-Sniper


texts: xml sitemap: insert node based on a term reference value

texts: I need to create a sitemap.xml to search engine submission. I know (and use) xml sitemap, but I need that the node is insert in the sitemap only if a field term reference has a specified value. Is there any hook_* that I can use in a custom module ?


texts: Hide the title or Change the Title style of one page based on page Title Multi site

texts:
I know that I can hide the title by using:

.page-node-43 h1
{ display: none;}

The problem with that is that I am using this css file for all of the websites that I am using. The websites have different node numbers for sometimes the same kind of page.
So there is the catch.

I want something like

.page-practial h1
{ display: none;}

But that doesn't work.
Do I have to use to achieve this? :)

Thanks in advance!


texts: How set background image for doc files when exporting nodes to Word in Drupal 7?

texts:
I used the Node to Word module in Drupal 7 to export nodes to Word. It doesn't have an official release for D7 yet, but there seems to be some D7 version of it in GIT. I downloaded this file) for it. This module supports writing template for a very convenient view mode.

How can I set the background image for the doc file when exporting a node to a doc?

I tried to use the background for the <div> sheathed same template but the export of the word, it has no effect.

Node template:

And result:


texts: Specify language of Comment using Entity Translation?

texts:
I'm building a site with multilingual support using Entity Translation. It is allowing authors to specify a language when creating a node, but there's no way to specify language when commenting on a node.

In Configuration > Entity translation, the Comment item is checked in the Translatable Entity Types section.

In Structure > Content Types > Post, I see tabs for Comment Fields, and Comment Display, but language is not one of the options.

I have been looking into the form_comment_form_alter hook, but so far have had no success with that.

In the Permissions panel, I confirmed that Administrator has "Translate entities of type Comment" checked. Even when editing a comment as admin, there is no option to translate.

The site uses Organic Groups 7.x-2.5, if that could influence this problem. The OG Post content type is the main one I'm trying to get fully functional.


texts: Language detection URL domain on localhost

texts:
I built a website in German on al local drupal installation. Now, I try to add English as a second language. As language detection method I am using URL. Using the path prefix option everything works well but when I try to use the domain option it doesn't work.

The domain option is what I want to use when the website is finally online.

mywebsite is in German and en.mywebsite is in English.

On my localhost I access my site with localhost/drupal722. I tried to configure the English URL as localhost/en.drupal722 but this does not work.

I deleted the path prefixes of both languages. Regarding the German domain configuration I tried both, leaving blank and insert localhost/drupal722/.

Does somebody has an advice on how to get this working?


texts:
I have been searching for a while, but cannot find an answer to this. How can I get access to the field name in a view (the label used in the content type)?

I am trying to create an anchor navigation through a view that only displays a link to a field if it has content. I have a custom content type with a number of long text fields and a view, and I would like to rewrite the content of the field with its field label but I cannot figure out how to access the field label. I would like to do it programatically in case the user asks to change the name of a field.


texts: How do I programmatically get a styled version of an image via imagecache in D7?

texts:
I want to save locally to the server, a styled version of an image attached to a node. "Styled" as in  filtered through a custom image style that I have already configured. What is the correct function, I can't find it anywhere.

I have file_unmanaged_copy() of the original image working fine, I can't see how to retrieve a styled version.


texts: How do I theme a menu to have a wrapper div with menu name?

texts:
The default menu theme function doesn't output the menu name (see below).

function theme_menu_tree($variables) {
  return '
' . $variables['tree'] . '
';
}

I've inspected $variables, and that doesn't contain the menu name. Does anyone know how I can theme a menu so that its name is in a wrapper div?


texts: Passing variables between theme preprocess hooks

texts:
I'm a newbie to Drupal 8 and PHP coding in general so I hope my approach is not too much out of the lines. I'm trying to theme some parts of my website by fiddling a bit with templates, what I need to do is to get a value of a specific preprocess hook function and pass it to another one, to be more precise I need to print the page title of the currently visualized wizard page of my Webform into the Page Title block, so it would show both the form main title and the current page title, basically generate a twig variable to put inside my page-title.html.twig template.

to get that value I've been doing the following:

function MYTHEME_preprocess_webform(&$variables){
  //Gets the current wizard page id
  $current_page = $variables['element']['progress']['#current_page'];
  //gets its correspondig value
  $page_title = $variables['element']['elements'][$current_page]['#title'];
  $variables['page_title'] = $page_title;
}

But of course, the value {{ page_title }} would only be available inside the webform.html.twig template and not inside the page-title.html.twig template.

Is there a way to have those variables available inside the MYTHEME_preprocess_page_title hook instead? Or is there a better approach?


texts:
Each time any node is being created, Drupal creates two copies of the same node, both in the default language.

What can be the reason of this duplication?


texts:
I want to create a CCK field with options determined by PHP. On the content admin page,  in the Allowed Values PHP code the example it gave was

return array(
  value_1 => label_1,
  value_2 => label_2
  ...
);

However, I want one of the options to be the user's name, so I used something like:

global $user;
$name=$user=>$name;
return array( 'main_guy' => 'No', $name => 'yes' );

For some reason, it won't accept quotes or dollar signs. If I delete the first two lines, and remove the quotes and dollar signs (return array(main_guy => No, name => yes);), it works ok.

Any ideas?
 That would be the same as the standard, non-dynamic list options.


texts:
I have created a wrapper in form of a "page" controller for my entity's form because I needed to do some tasks before it was rendered.

I ended up with this:

<?php
  class MyEntityController extends ControllerBase {
    public function mymethod(AnotherEntity $anotherEntity) {
      $myentity = $this->entityManager()->getStorageController('myentity')->create(array());
      $form = $this->entityManager()->getFormController('myentity', 'default');
      $form->setEntity($myentity);
      $form->setParentEntity($anotherEntity);
      $form->setRedirectRoute(array(
        'route_name' => 'some.route',
        'route_parameters' => array('somearugment' => $anotherEntity->id()
      ));
      return $this->formBuilder()->getForm($form);
    }
  }
?>

Is this the recommended way in regard of the entity form itself(ie. manually setting the form's entity object)?


texts: Have to hook into a function from a module

texts:
I am using the LinkedIn Integration module and have created a custom module to add some functionality.

Please see the linkedin.inc file at line 17 - function linkedin_access_token($account)

When a user links their LinkedIn account, I want to add to the db_write_record to also write to a custom field in my database for a timestamp.

Not sure what hook to use since it is a function.


texts: How can I make 2 Drupal websites share the same user table so when a user is logged in on one they are automatically logged in on the other?


texts:
Drupal 7. I work on multi language site. I have a content type with entity translation fields. I've added translation to field labels and settings on my DEV copy of site and now I need to export and import it to Production.

Is there any module in Drupal 7, that helps me to export and import field labels/settings? Or maybe someone tell me, how to export values from "locales_source" and "locales_target" tables and import it to my Production database? Because I see only "lid" auto increment field in both tables.

Locales Source table

Locales Target table


texts: How to get current product id from custom block?

texts:
I've problem to get current product id from custom block displayed on product page. Here my code :

class TestBlock extends BlockBase {

  public function build() {

$product = \Drupal::routeMatch()->getParameter('node');

$productid = $product->product_id();

return array(
 '#markup' => $this->t('Product ID : ') . '<h2>' . $productid . '</h2>',

    );
  }

}

Do you have any idea to get the current ID from product ?

Thank you for your help.


texts: Menu add item or edit item not available for users with admin rights

texts:
I'm working on a Drupal core 6.26 website and I'm unable to debug or find an answer for this problem.

I have a group of users, let's call it GroupTest that has permissions enabled for administer menu.

When trying to edit a menu item or add a menu item with a user from GroupTest group, the add item / edit item form (actually just the fieldset Menu settings) is hidden by an inline "display: none;" style. The only thing visible is the save button.

However, this doesn't happen when I'm using the admin (1) user. The form is displayed just fine.

I've tried different approaches to debug this, looking for hook_form_alter in custom modules/themes that might be modifying this, even for javascript code that would hide the form.

Any help or hint would be greatly appreciated.


texts: Two forms on the same page - both submit the same

texts:
I have two forms on the same page, both called with drupal_get_form('some_form_name', $product_id);. The $product_id variable is used to fill in a hidden input. (The code is in a foreach, the $product_id variable is different for every form.)

In the generated HTML, the forms are correctly built. Both have different IDs, and both hidden fields have the correct value.

However, in the submit function of this forms, with the following code:

function some_form_name_submit($form, &$form_state) {
    dsm($form_state['values']['product_id']);
}

The product id is always the same. The first generated form's product id.

After some research, I found out that the hidden input form_id is the same in both forms. Looking into that.

Is there a way to solve this?


texts: How can I reuse translations from other contexts?

texts:
I know that in Drupal 7, contexts are used to provide multiple translations for the different meanings of the same string.

This works great for sentences that do have different meanings depending on the context. But for most of the cases, this means that I'll need to translate the same string twice or more times.

Is there a way to automatically reuse the translations from other contexts, when it's not already translated for the real context of the string?

If not, what is the best way to automatically import all the translations from one context to another?


texts:
I am using Node clone.
The administration part of the module works 100%. I can edit the settings, but the clone tab that should appear beside the other node related tabs (edit, devel...) does not appear.

Has anyone out there used this module and could help me?


texts: How to get the url from uri, uri given as string

texts:
I have a string

$directory = "/home/ .../sites/default/files..."

I tried to get the absolute url with:

$MYURL = Url::fromUri("base://".$directory);

That leads to an exception!

Can anybody explain hot to retrieve the url from a string?


texts: Prevent enter to submit form / disable enter

texts:
I am trying to prevent to submit the form when a user is pressing enter. I am trying to do so in a form that is also using ajax. I want to have the user click on submit after filling out all the necessary stuff and not have them accidentally press enter and have the form submitted.

I have the code below; the alertbox is popping up when pressing 's' for example. also when I press enter I can get a alertbox popping up. But it is not preventing to submit the form.

$("#edit-searchfield").keydown(function(e){
  var code = e.which; // recommended to use e.which, it's normalized across browsers
  if (code == 13) {
    e.preventDefault();
    return false;
  }
  if (code == 83 || code == 13 || code == 188 || code == 186) {
    alert("I am an alert box!");
  }
});


texts: Why the core migrate modules won't be enough?

texts:
I've seen that Drupal 8 comes with 2 core migration modules; These are "Migrate", and "Migrate Drupal".

My question: if we want to migrate SQL from a Drupal 7 site to our brand new Drupal 8 site, why aren't these two enough, and why do we also need to download the module Drupal Upgrade? Wasn't there a plan to make the process free of any contrib modules whatsoever?


texts: 'Create new book' in Drupal 6 won't create, only shows loading icon

texts:
Through the admin, Anytime I try to create a new book in Drupal via 'Create Content' > Book page and select '', the loading icon hangs there. When I save the entire page, it creates the page but it doesn't add it to the new book. Going to the list of books does not show the new book either. So, the object isn't being created.

I have feeling this could be a frontend error, but I'm not really sure where to start. I checked the Javascript error console and no errors there, so...

I've attached a screenshot for more context.

I am not going to upgrade to Drupal 7, if someone suggests this.

Maybe there is a way to programmatically create a new book until I figure out what the problem is.


texts: Change the value of a piece of content using a comment

texts:
I have a content type which I don't want a user to be able to edit once it has been created.  but I want them to be able to change 1 value and the way I want them to do that is through a selection box on a comment.  For example, on the content type there is a priority field.  When a user leaves a comment I have a selection box added to the comment with the same options.

How can I get that option box to sync with the option in the node itself?

Thanks

Kieran


texts:
I would like to use a node location values (for example location:country-name) as tokens.
Is it possible to use something like [node:location:country-name] ?


texts: How do I display all the nodes in an organic group?

texts: I'm on d7. Im trying to figure out how to display all the nodes that are in an organic group. I feel like this is a major thing that the OG module should do and don't know why I cant figure it out. I have views installed and have looked at the OG content view, but it doesn't display anything when I test it with the preview filter. Ive seen a video on how to do this with panels, but I don't have panels installed and don't plan on it. Thanks for the help.


texts: select paged nodes by using selectNode of drupal 7 service module?

texts:
i'm developing a mobile apps call the drupal service, i'want to get paged nodes of relative taxonomy_term, selectNodes seems can help

http://domainABC.com/my_services/taxonomy_term/selectNodes/

But how do i call page 2 of the nodes of the taxonomy_term (suppose 25 nodes per page)?

i looked the source code (taxonomy_resources.inc) but still don't have idea to do ,

    function taxonomy_service_select_nodes($tid = '', $pager, $limit,  $order) {
      $result = taxonomy_select_nodes($tid, (bool)$pager, $limit, $order);
      foreach ($result as $nid) {
        $node = node_load($nid);
        if ($uri = services_resource_uri(array('node', $nid))) {
          $node->uri = $uri;
        }
        $nodes[] = $node;
      }
      if (empty($nodes)) {
        return services_error(t('No nodes were found with tid @tid', array('@tid' => $tid)), 404);
      }
      return $nodes;
    }

'actions' => array(
        'selectNodes' => array(
          'file' => array('type' => 'inc', 'module' => 'services', 'name' => 'resources/taxonomy_resource'),
          'help'   => t('This method returns all nodes with provided taxonomy id.'),
          'access arguments' => array('access content'),
          'callback' => 'taxonomy_service_select_nodes',
          'args'     => array(
            array(
              'name'         => 'tid',
              'type'         => 'string',
              'description'  => t('The vocabulary ids to retrieve, separated by comma.'),
              'source'       => array('data' => 'tid'),
              'optional'     => FALSE,
            ),
            array(
              'name'         => 'pager',
              'type'         => 'int',
              'description'  => t('Whether the nodes are to be used with a pager (the case on most Drupal pages) or not (in an XML feed, for example).'),
              'source'       => array('data' => 'pager'),
              'optional'     => TRUE,
              'default value'=> TRUE,
            ),
            array(
              'name'         => 'limit',
              'type'         => 'int',
              'description'  => t('Maximum number of nodes to find.'),
              'source'       => array('data' => 'limit'),
              'optional'     => TRUE,
              'default value'=> FALSE,
            ),
            array(
              'name'         => 'order',
              'type'         => 'int',
              'description'  => t('The order clause for the query that retrieve the nodes.'),
              'source'       => array('data' => 'order'),
              'optional'     => TRUE,
              'default value'=> array('t.sticky' => 'DESC', 't.created' => 'DESC'),
            ),
          ),

The callback function

function taxonomy_service_select_nodes($tid = '', $pager, $limit,  $order) {
  $result = taxonomy_select_nodes($tid, (bool)$pager, $limit, $order);
  foreach ($result as $nid) {
    $node = node_load($nid);
    if ($uri = services_resource_uri(array('node', $nid))) {
      $node->uri = $uri;
    }
    $nodes[] = $node;
  }
  if (empty($nodes)) {
    return services_error(t('No nodes were found with tid @tid', array('@tid' => $tid)), 404);
  }
  return $nodes;
}

Anyone know?


texts: Make variables created in preprocess_page hook available to content type templates

texts:
I'm attempting to render a block plugin programmatically in a content type template. I understand how to render the block programmatically in a page template. like so

mytheme.theme

function mytheme_preprocess_page(&$variables){
    $myblock = \Drupal::service('plugin.manager.block')->createInstance('myblockid',[]);
    $variables['myblock'] = $myblock->build();

page.html.twig

{{ myblock }}

However in

node--contenttype.html.twig

{{ myblock }}

Produces nothing. Is there another hook I should be using? Or is there a better way to do this entirely?


texts: Administrator verification for user role type

texts:
Is it possible to add admin verification for specific user roles.  For instance, my site has three user roles, one of which would should get verified before gaining access to the content.  I realise there is an option " Visitors, but administrator approval is required" in the
people > administration tab, but this would be for all users.

I'm managing roles directly through Drupal 7 and not using any modules such as profile2.

Thank in advance,

Cheers,


texts: Is there a way to determine what styles can be used for a nice menu?

texts: I am attempting to style a 3-level "nice menu" but between the themes and menu styles, I am having a hard time finding the correct styles to change.  I am using firebug, but I cannot get the styles for some menu items, because moving the cursor over them changes them to hover (or focus).  Unselected menu items are not displaying consistently at all levels the way I want and I cannot identify the styles without hovering on them.  I need to find out what the full styling options are so that I can figure out what is affecting them.


texts: Why is Rules Link checking all Rules Links on every page load?

texts:
I am using the Rules Link module in a Drupal 7 site.
The site contains a view that lists a number of entities, including the Rules link field.
The Rules Link rule set is simple: when clicked, data of a field value is set.
The rules link works fine, however ...

When I check the recent log messages (dblog) I see that every page load of that views page, Rules link repeats a check on every rules link available on the page. Such as this Rules link where

" Executing and Rules link: Bin condition.
0 ms Executing and Rules link: Bin condition.
0.098 ms AND evaluated to TRUE.
0.11 ms Finished executing of and Rules link: Bin condition.

I did not include a trigger for when a page is viewed, so I think this is strange.
And even stranger, why is a rules condition check for every link listed in a view? I get long lists in my dblog showing repeating Rules Link condition checks.


texts: What is Content Construction Kit (CCK) in Drupal and what is the purpose of CCK?


texts: Use views to display taxonomy children terms from parent

texts:
I'm hoping there might be a solution to this, but I do not have too much hope after searching a bunch. Currently I have some articles that have terms associated with them and these terms are 2-3 levels deep. For example I might have 10 articles that have the term 'green'.

-Fruit
--Apple
---Green
---Red

I then would like it to have the user be able to view all the video's associated with a specific taxonomy term including all of its children. So if the user goes to www.site.com/fruit/apple, then ALL of the apples will show (Both Red and Green).

Here is the problem. I can only make it work if I assign each article all the parent terms leading up to the child term, but unfortunately, the way that my site is constructed, I can only have it so that my article has the deepest term associated with it.

Does anyone know if it's possible to create a view that will look at all the children of a term and include that in the view? I hope I am explaining it correctly. :)

Ex. User goes to www.site.com/fruit/apple and then they get all the articles that are only tagged with 'green' and only those with 'red'.

Thanks guys!

P.S I have hierarchical select installed, but that does not help me because I cannot have it assign parent terms to my articles. So that won't work.


texts:
I'm using HTACCESS to force all my pages to redirect to the HTTPS version. However the home page is still able to go to the HTTP version.

I tried 2 examples from this post: How to simply make the whole site HTTPS?

And they work, but not for my home page as I mentioned. HTTPS is redirecting everywhere except the home page.

RewriteCond %{HTTPS} !on
RewriteCond %{HTTP_HOST} ^www\.yourdomainhere\.com*
RewriteRule ^(.*)$ https://www.yourdomainhere.com/ [L,R=301]

And

RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Edit: When I go to the HTTP version of the home page, any time I click a link it redirects to the HTTPS home page instead of the respective link. After that once on the HTTPS home page all links work correctly.


texts: (How) can I Create products by the square foot?

texts:
I have a product that I need to sell by the square foot, where the customer would enter the length and width, and the number of sq ft would be the unit amount on the product line. That unit number should then only be changed by updating the length/width fields (not by direct customer entry). Is there a commerce module or combination of mods for that. I've tried commerce custom product, and tinkered with rules, but can't make it work.
Maybe I need a custom module?
Any advice appreciated.


texts: Cannot send private message to all authenticated users by rules

texts:
I am trying to broadcast a private message (privatemsg) to all authenticated users when adding a new node of specific content type.

However, I cannot find Authenticated user option on the roles select box (these're only user-defined ones, no system roles).

I tried to use a specific user to send the message (the permission to send to a role is granted), and set the role parameter to [selected-user:roles] to send to same roles as the user himself. However, the authenticated users still could not receive the message, and users of other roles (like member, administrator) could receive it.

The message could be successfully sent to all authenticated users via /messages/new form.

What is the problem?

I found the answer

It turns out that the users could receive the messages after the cron is run.


texts: How to list comma seperated nodes titles on each row of a views table of terms listed with a column of nodes used by this term

texts:
I try to achieve the up-side-down scenario of that what many Drupal users know as one of the standart Views views, where a list of nodes has a field (column) listing all terms used with commas like this:

node1 | some_other_field | term1,term2,term3
node2 | some_other_field | term1,term2,term3
node3 | some_other_field | term1,term2,term3

But in the case of this question it is exactly the other way around: A list of terms with a column showing the nodes using the term. And the challenge is that we need the edit link to the term on each row so we cannot use the aggregation trick using the listed nodes view, summarized and grouped by each term. We need to achieve it by using the real terms view, with a final result like this:

term1 | some_extra_term_field | used by: node1,node2,node3
term2 | some_extra_term_field | used by: node1,node2,node3
term3 | some_extra_term_field | used by: node1,node2,node3

Adding the respective relation of node types to the term list view and adding one the node fields (title) using the relation we get a list of many duplicated rows of the same term, each row showing one node under the colum "nodes used".

So how can I force the view to show me the node titles listed on each term row like we can list terms on node list views? Since in Drupal 8 all are entities and terms are just other entities "related" to nodes, it should actualy work both ways out of the box. But it sadly doesn't.

EDIT: Thanks to Clive, who gave me already an idea how to achieve that. But I would prefer a solution in Views UI only for this answer. But if this is not possible, we can go for a custom code/module answer on this then.


texts: I have tried every possible ways to create a user account using only a single PHP file without writing a module. I want to create a portal in which visitors can subscribe or register themselves and do something after they logged in. I have also a mobile application (Android and iOS) in which my app users can register (subscribe) and use the app in their mobile phone. Both the web application and the mobile application use the same API to create a Drupal 8 user. Is there anyone who help me out to achieve this?


texts: Restrict node list in entity reference field based on node field

texts:
My "Article" nodes have a "domain" field that links to a taxonomy term.
My "Article" nodes also have a repeatable "entity reference" field "more like this" that links to other "article" nodes.

How can i restrict the list in the "more like this" field to show only the nodes that have the same "taxonomy term" that the node i am currently editing ?

Thanks a lot !


texts: How to export the translation of a vocabulary?

texts:
I have 2 vocabularies. Vocabulary 1 and Vocabulary 2.

Vocabulary 1 is exported in feature test_feature1 and Vocabulary 2 is exported in test_feature2.

My site is multilingual. I want to export the translation of Vocabulary 1 in test_feature1 and the translation of Vocabulary 2 in test_feature2.

How will I do that?

I have tried Features Translations but it exports a set of translations like translations of all the taxonomies.

Is there any other method to export the translations of a specific vocabulary in a module. Any other hook? which I can implement in both modules for each vocabulary?


texts: Flexslider images and thumbnails not being displayed in Firefox 36

texts:
I have got a problem that hopefully someone can help me with. I am using the Flexslider module in Drupal 7 and have created a slideshow with thumbnail navigation. This works fine in Chrome, however in Firefox all but the first thumbnail (and the corresponding slider image) are not loading (see the image).

Here is the generated html source (as seen within Firefox):

You can see that the img link displays source undefined for some reason. Has anyone come across this before? Is this a problem with Firefox or an issue with Flexslider and how would one go about fixing it?


texts:
How do i create a content type field using Drush or Drupal Console? I tried both ways but nothing seems to work. I am using Drush Commandline Tool 9.7.1 and Drupal Console version 1.9.4.

Drush: $ drush generate field poll_name

  ArgumentCountError: Too few arguments to function Twig\Extension\StagingExtension::addFilter(), 1 passed in /home/muneebmukhthar/.composer/vendor/twig/twig/src/ExtensionSet.php on line 222 and exactly 2 expected in /var/www/html/drupal_8_minimal/vendor/twig/twig/src/Extension/StagingExtension.php on line 49 #0 /home/muneebmukhthar/.composer/vendor/twig/twig/src/ExtensionSet.php(222): Twig\Extension\StagingExtension->addFilter(Object(Twig\TwigFilter))

Drupal Console:

There is no direct command to generate a content type field in drupal console. I tried $ drupal generate:plugin:field as suggested somewhere which is used to create Generate field type, widget and formatter plugins inside a module, and not a content type field.


texts: What is the benefit of using Entity types over Entity bundles from a usability perspective

texts:
I have installed ECK and created different entity types for a project management website. For example Project, Group, Task, Report.

Each entity type requires at least one bundle, so I named the bundle the same as the name of the Entity type (which ECK does by default).
I did not add custom Entity properties to any type. This is mainly because there are many modules that don't support Entity properties (yet).

I also added an extra bundle 'Issues' to the entity type Task.

The problem that I now face, is that a lot of modules have limitions in the way they use and display data, in that it must be configured for one specific entity type. For example, each view, each flag and each panel must be based on one entity type. Any module that deals with entity fields must create multiple instances for each entity type.

This requires me now to create a lot of views and flags for all entity types that I created. Not a really efficient or usable situation.

So after all this, I must conclude that I would better have created only one ECK entity type called 'Entity' or 'Project element' and add the Project, Group, Task and Report as bundles.  They only share some basic system/ECK fields anyway like title author date created etc.

Am I right, that using multiple Entity types is actually not necessary and even not recommended, unless there are many bundles that could share a lot of entity properties?


texts: How to slow down migrate? Cloud Files can't keep up

texts:
I'm using migrate to import 2800 blog posts. Each have a header image which is getting imported. I'm using Rackspace Cloud Files as my CDN so the system is copying the image files up to Rackspace Cloud Files, but after it's been running for awhile I start getting this error:

  (/home/drupal/html/sites/all/libraries/rackspace/php-cloudfiles/cloudfiles.php:608)
  Invalid response: (curl error: 35) error:02001018:system
  library:fopen:Too many open files: Failed  [error] to obtain valid
  HTTP response.

My -guess- is that the migrate is working too quickly and the file transfers are happening in parallel or something and I'm hitting a limit on the number of open files for Rackspace. I'm not exactly sure.

I'd like to try adding a delay in between each node. There are only 2800 and I can let it run for a little while, so I don't mind the delay as long as it'll let me complete the migrate.


texts: Change values of user input in hook_field_validate?

texts:
I have setup a custom field and have a validater setup for it. I would like to be able to adjust and actually change the user input from within my validator. so say this is a multi value field, each set of values shows up in $item. I have adjusted and changed the values in this function, but how I can I save them and make sure the rest of the form processes using the changed values?

mycustomfield_field_validate($obj_type, $object, $field, $instance,$langcode,   &$items, &$errors){

  foreach($items as $item){
  // validation check is here
  }
}


texts:
I have a content type documents and my fields (created by admin) are:

Doc1
File
Date
Doc2
File
Date
Doc3
...

The reason why I don't do a content type just with: "Doc, file, date" and add the nodes I want is because I need the Document name to be written by admin, and no one can edit it.(for example: birth certificate) (If you have an idea to do this other way, I'm listening)

This way, the user inserts just one node with all of those fields.

I want to somehow group those fields (Doc1, file, date) and display it like a view.

Views display all nodes from a content type. I need to display the fields of just one node, like a table. Is this possible?

Thanks


texts: Setting up permissions for non-registered users

texts:
How do I set permissions for non-register users?

Step 1: I registered Drupal 7 in my system.

Step 2: I wrote a module for user_register().

Step 3: When I call the menu callback an access denied error  is shown.

How should i set permission to non-register users to register?


texts: Is it possible to hide fields on node edit form or split node edit form in two screens?

texts:
I have a content type cFoo. This content type has e.g 10 fields.

I want:

user has page node/cfooxx/edit/screen1 and sees only fields 1,2,3,4,5
user has page node/cfooxx/edit/screen2 and sees only fields 6,7,8
user has no access to fields 9,10

I did a lot of reseach on this but it is not clear for me.

how to get the splitting of the standaard node/xx/edit url to edit/screen1 and edit/screen2?
On the front I use display suite so I can manage a display. Is there a module which can do this with edit forms as well?
If I use css, still fields of screen1 are processed in background of screen2 and the other way around. I do not want this because of possible errors in form validation. But suppose i need to do this... then the /node/cFooxx/edit url containts fields 1/2/3/4/5/6/7/8. So how to decide which css to apply when entering /node/cFooxx/edit?
If I use hook_form_alter how to identify screen1 and screen2?
Point 3 I can solve with field permissions module


texts: Is there a tool to covert any template to drupal 7 theme?

texts: Is There any tool to convert any template (wordpress, joomla, static html/css etc) to a drupal theme


texts: How to create grouped filters based on integer range?

texts:
I'm developing a recruitment website which will allow users to filter jobs by salary. It has been designed so that the filter is grouped into salary ranges like this...

I am using the Range module in order to add a range field to my job content type (essentially just two text boxes). The idea is that the admin can enter in any 'from' and 'to' integer (doesn't have to be a value that matches one of the filters e.g. £20–25k). Instead the query should be able to adapt and show any matching results.

The issue I have is that because I essentially have two fields saved there doesn't appear to be any simple way of grouping filters. I have attempted to use the Global: Combine fields filter but this only works with strings, not integers.

I've also attempted to add the Salary range filter included with the Range module under the Filter criteria heading of my view but this doesn't appear to work either. Here is a screenshot of what I attempted (I'm assuming that the Range module doesn't actually store the integers in-between the 'to and 'from' fields so I guess this wouldn't work. I'm also not sure that separating the values with commas is valid either).

The only method I can think of would be finding a way of adding the two fields together to create one total integer which would then allow me to use the standard is-between operator available when filtering a single field in Views.

Thanks in advance.


texts:
I have a site where we need to bulk import users into the system, however the client wants to be able to import the users into the system but have them inactive until a later date,

The idea is that we operate online training courses, so we will receive user data from an organisation as part of our onboarding - however we do not want to give the users access to the system until it is time for them to start their course.

My idea was to use the User Import module to bulk import - however I can not see a way to set the 'status' of users when importing - as a result all users have instant access to the system. Is there any way to do this with the User Import module?

If it was possible, we would then use a VBO operation to change the status of the users to active at the appropriate date - this would also mean that users would receive the site configured activation email with the appropriate log-in information,

Any help or alternative implementation suggestions would be greatly appreciated,

Thanks,


texts: How to set a newly created node's menu parent based on selected taxonomy term?

texts:
I am using the module taxonomy menu which autom. created menu items for each term of my vocabulary. Now, when I create a node and save it, I dont want the author to have to select the term AND set the menu parent to that exact term (twice) also.
Is there a way, for instance in the node presave hook, to look which term was selected and then set the created node's menu parent to that?

Here is what I have so far:

    function simplyvegan_node_presave($node) {
        if (isset($node->type) && $node->type == 'recipe') {
            if (isset($node->field_myvocabulary)) {
                $terms = field_get_items('node', $node, 'field_myvocabulary');
                // debug($terms);
            // now set the node's menu parent to that term
        }
    }
}

Update due to comment:

I have radio buttons to select a term (= category of the node) when adding a node, for instance the vocab "categories" has the terms "awesome", "not so awesome" and "foobar". Everytime I add a term to that vocab, the above mentioned module automatically adds that term as a menu link.

So, instead of manually pick that term as the nodes parent menu item, I want my module to do that. In the menu settings, to the very bottom of the node creation form, you can check "add menu link" and choose what menu item will be the parent. Thats the thing.


texts:
I have created a Drupal project, on that project I have many files uploaded. But when I crawl the project through crawlers I am getting files as file url like the following.

http://project.com/files/file2png
  This means I have a file in my files directory as file2.png
http://project.com/files/file1png
  This means I have a file in my files directory as file1.png

I have a File Entity module. Does it create url in this format?
If yes, how to avoid this?

And I don't know which module makes this. I want to avoid this. Is there any way to remove creation of file paths for my files?


texts: How to perform of complex import of custom data?

texts:
Probably, there will be several tasks where I will need to perform import custom data from CSV or XLS files to Drupal 8 taxonomy vocabulary.

Moreover, when importing data it will have to be modified in various ways, or even be assembled from several tables into one vocabulary. That is, it won't be import data "as is" and "one-to-one".

Thus far I have found the Feeds module and the Migrate module.

In Drupal 7 I mainly used the Feeds module. But I suspect that for Drupal 8 most people are mainly using the Migrate module, whereas the Feeds has been abandoned by developers.

Please share your experience about:

which solution you use in such cases of complex data import ?
how you solved such import challenges in Drupal 8

That should help me to decide which one is the best for the challenge I'm facing.


texts: How do I implement an image categorization system using Entity Browser and File Entity?

texts:
I am currently using the Entity Browser module along with the File Entity module for handling image upload and selection for content editors in a Drupal 8 project.

I have several image fields on different content types and to get some structure for them I would like each image field to be mapped to a certain image category (taxonomy) so that the user can filter between categories when selecting existing images using the entity browser.

To do this I am using the File Entity reference for my image fields. I have added a taxonomy field with my custom ”image category” taxonomy on the Image File entity type. So far so good.

My first problem is that I want automatically populate the image category field with a certain value when adding a new image through the entity browser. So if I upload an image to a ”hero image” field the underlying file entity should get the category ”Hero images” automatically. I’m lost to how to hook into the upload process of the entity browser to set this based on which field it belongs to. How can this be done?

The entity browser also allows the user to select existing images. For this I'm using the view prepackaged with the File entity browser modulle and I have added a taxonomy dropdown filter to that view so that the images can be filtered by category. What I want to do is to have this view automatically set the correct filter when loaded. So when loading the view from a ”Hero Image” field the dropdown has the ”Hero Image” category preselected.

So essentially I'm missing two parts:

Automatically populating the file entity "image category" field when uploading an image based on which field the image was uploaded to
Automatically prepopulate the "image category" exposed filter in the "select existing image" view based on which field it was opened from

Can someone help here. Maybe there's a better way to go about this?


texts: Proper way to add external JavaScript file

texts:
What is the proper way to add Amazon oneTag code to Drupal 8. Instructions say to add it before the ending body tag.

I think it should be loaded to the /theme.libraries.yml. Here is the code I am trying to add:

Do I need to create a file onelink.js with this code? Then reference it in libraries?

Thanks


texts: How do I configure the database using php_server module

texts:
I am trying to set up an existing site locally. It seems that Drush cannot find the site. When I run drush cc all, I get this error.

  No Drupal site found, only 'drush' cache was cleared.

I think the issue may be with my server configuration. I am using the PHP Server module, and I'm not sure how to get it to point to the database.

This is what drush status returns, for your reference:

 Drupal version         :  7.41
 Site URI               :  http://default
 Database driver        :  mysql
 Database hostname      :  localhost
 Database username      :  root
 Database name          :  quorum
 PHP executable         :  /usr/local/bin/php
 PHP configuration      :  /usr/local/etc/php/7.0/php.ini
 PHP OS                 :  Darwin
 Drush script           :  /usr/local/Cellar/drush/8.1.11/libexec/drush.php
 Drush version          :  8.1.11
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /Users/Jillian/ideometry/quorum-dev
 Drupal Settings File   :  sites/default/settings.php
 Site path              :  sites/default


texts: Setting up local dev, "call to undefined function" from a module that I uninstalled a few months ago

texts:
I'm attempting to set up Acquia Dev Desktop with a database dump and git repo from Pantheon.

I was using the Computed Field module in this project but I rewrote the code in my own custom module and uninstalled Computed Field a couple months ago (uninstall from modules page and removal from my git repo afterwards).  I had no errors on the Pantheon site related to this, and I just made the db and code dump yesterday.

However, when I import into Dev Desktop, I'm getting the following error:

  Call to undefined function computed_field_entity_property_callback()
  in
  /Users/pk/dev/mysite/sites/all/modules/contrib/entity/modules/field.info.inc
  on line 30

computed_field_entity_property_callback() is a function defined in the Computed Field module, which shouldn't exist on my site anymore.  So somehow there is a "ghost" left in my db somewhere-- how can I locate where this error comes from, because I can't even get a page to load-- all I'm getting is this error.


texts: Drupal 8 always editing a translation, never the original

texts:
I have a website with 4 languages, while English is the default. Each language has its own directory (mydomain.com/contact, mydomain.com/jp/contact, etc.). I have the following languages:

English
Czech
Japanese
Russian

For the record, my language detection is configured with these priorities:

URL
Session
Selected Language
Browser

When I try to edit a translation of a content page (let's say Japanese), it works just fine, but when I try to open an edit page (mydomain.com/node/6/edit) of the orignal, english node, I'm always getting "Edit Basic Page Nobg Kontakty [Czech translation]", with the Czech content and can't access the edit page for the english original. What to do?


texts: A PDF field open in a new window of Drupal

texts:
I add a field which type is PDF. When I click the PDF file, I want the PDF file to open in a new window (using target="_blank").

How do I add such target="_blank" to the a label?


texts: How can i make my solr search case sensitive?

texts:
I am using search api and search api solr module,
currently my search is case insensitive with following configration.

<fieldType name="text" class="solr.TextField" positionIncrementGap="100">
<analyzer type="query">
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>

if i remove <filter class="solr.LowerCaseFilterFactory"/> it becomes case sensitive.
How can i have both the thing?