texts:
In my menu I want to add icons. Now when I look for a way to do this, I found a module called Menu Link Attributes. When I configure this on all my menu items, I can't only get it working when using the link function in twig. Now this is not a the expected way of working. Because in the module I add the class names of a awesome font icon. So I need to find a way to manually place the class in my twig file.

The module settings looks like:

attributes:
  class:
    label: ''
    description: ''

I treid using the {{ item.attributes }} in my menu.html.twig file but this is always empty.

Can someone help me on this? How can I place the class attribute in a custom i tag?


texts: How can I avoid this markup is filtered out from my block?

texts:
I generated a widget on pinterest. The result is the following:

pinit.js is included in the theme and is available in the page.

I added a block with the following code.

When I saved the block (I used CKEditor), it cleaned. Actually, I don't know if it is cleaned by CKEditor or the full HTML filter.

How can I find out which of those is cleaned out the markup?

If it's due to CKEditor, how can I solve it? The advanced content filter is disabled.
If it's due to full HTML filter, how can I configure it so that only this non compliant syntax is allowed?

NOTE: In the full HTML filter, the checkbox Correct faulty and chopped off HTML is NOT checked.


texts: How to subscribe to any or all taxonomy terms on one page?

texts:
I'm wondering about the best way to set up "subscribe to get email alerts"

I have a content type which is "tagged" with various terms from various taxonomies
and I want to set up a simple "subscribe to get email alerts" page, where users can subscribe to whichever 'terms' they like, so that emails are sent to them when a new item of the content type is created with the associated tags.

I have installed the notifications and messaging modules
which have enabled me to create a "subscriptions block", which is presented on the content pages with links like "Subscribe to: Content tagged with: XXXXX", which allows users to subscribe to a specific tag.

But what I really want is a page, which lists ALL available tags (terms) a user could subscribe to, with check boxes, so the user can skim the list and subscribe to any / all the tags they are interested in, in one go

I am struggling to work out how I might do that using the notifications and messaging modules…
perhaps I would be better off allowing users to 'tag' themselves with the same terms used on Content Type… and then set up a rule which fires an email to the user if new content (of the specific content type) is created with the same terms as they have tagged themselves with?

But I'm not entirely sure how I would go about that… or if there is a better / simpler plan?

I don't think this is a very complicated task - and am surprised I can't find links to similar requests / solutions online…

Any advice appreciated!


texts:
I have a new text format sample_page with the filter sample_page, I've created using hook_filter_info(). In the callback, I am rendering a webform using depending on the token in the node body, for webform I'm planning to use a token [block:webform:webform-client-form-2423].

I could render the blocks created programmatically, system blocks. But not the blocks created by other modules, I have tried [block:user:login] from http://mine.local/admin/structure/block/manage/user/login/configure to render to login blocks too. But these blocks didnt seems to work. Here is my callback for filter.

System blocks that worked for me, I used the token [block:block:25] from http://mine.local/admin/structure/block/manage/block/2/configure and for blocks created programatically by my own module, suppose my module is my_module,
I have used the token [block:my_module:block_name] from the url http://mine.local/admin/structure/block/manage/my_module/block_name/configure

preg_match_all('/\\[([a-zA-z0-9_\-]+:[a-zA-z0-9_\-]+)+\\]/m', $text, $match);
$matches = $match[0];
foreach ($matches as $token) {
  $token_name = str_replace(array( '[', ']' ), '', $token);
  $type = explode(':', $token_name);
  if ($type[0] == 'block') {
    $module = $type[1];
    $bid = $type[2];
    $block = block_load($module, $bid);
    $replacement = render(_block_get_renderable_array(_block_render_blocks(array($block))));
  }
}

Can any one look into the problem. Any help would be appreciated...


texts: Determine Next Item in DrupalQueue for Drupal 7

texts:
I am trying to figure out how Drupal pulls what will be the next item to be processed in the queue for Drupal 7.  I have looked at SystemQueue::claimItem and I am missing something.  I have a queue that jams from time to time and I do not know how to figure out what record it is jamming on.

Thanks,
Steve


texts: How to migrate a real real messy Drupal setup to a fresh, new, well structured and totally new stable environment

texts:
The situation is as follows: there is a Drupal website which has loads of content (it is for a popular Iraqi newspaper), but the way the website has been built is very, very very messy. Content types are awkwardly structured, views are a total chaos, css is a big pile of non-structured, non modular and totally not maintainable setup of statements, there's no consistency whatsoever. Moreover, many things are in such a way implemented that upgrading to a newer version (Drupal 7 for instance, it is still running on 6) is gonna be a real pain in the ass. This site is doomed to be redesigned from bottom up, otherwise every change will make it more inconsistent and more difficult to maintain.

I'd really like to migrate it to OpenPublish. It's been proven to be a good environment for news-outlets, with well established worflows.

But where to start? How do I map these messy, and awkwardly structured content types to the more properly structured ones that OpenPublish uses? And then: how do I migrate the data, without losing any information? Basically they are the same types of content from an abstract perspective: news-articles, blog posts and pages, but internally there's loads of differences and difficult hurdles to overcome.

Are there any modules that are able to map different types of content types and tell which fields correspond to each other? Are there others that enable you to migrate the data without losing information and structure?

edit: added examples below

Two particular problems for instance:

In the messy version, each article has an author. An author is always a regular user account. So the amount of user accounts has exploded with registrations that are actually not used. OpenPublish links user profiles (which are nodes basically) to articles. Problem: howto resolve this inconsistency when migrating data?
Similar problem: in the messy version, each article has a slideshow field (which can contain multiple images) as part of the node article. In OpenPublish you create a reference to a separate gallery node, which also has more meta-information attached to it. How to split those up, without losing their relationship?

Any tips? Best practices? Thoughts?


texts: Automatically importing module-provided translations during installation

texts:
I have a custom module whose interface strings have all been written in English. This module is not (and will not be) hosted on drupal.org, so I'd like to pack the translations for those texts directly with the module, and for those translations to be automatically imported by Drupal when the module is installed (provided the corresponding language is activated in Drupal, of course).

I've translated those texts in French and exported all those translations in a my_module-fr.po file. I've put this file in the "translations" folder inside my module folder.

As suggested in this answer, I used the interface translation properties in the my_module.info.yml, as follows:

'interface translation project': my_module
'interface translation server pattern': modules/custom/my_module/translations/my_module-%language.po

But when I install my module from scratch, those translations are not automatically imported.

In admin/reports/translations, it says "Missing translations for one project - my_module (1). File not found at modules/custom/my_module/translations/my_module-fr.po".

I've tried several variations for the interface translation server pattern value in the info.yml file, among them:

path relative to the module folder (translations/my_module-%language.po) instead of the Drupal folder
full path to the drupal install folder (since I'm on localhost and Drupal is in a subfolder) (_tests/drupal8/www/modules/custom/my_module/translations/my_module-%language.po)

But I always get the same "file not found" message in the admin report page, and nothing is imported.

What am I missing?

Side question: in the YML declaration above, is it allowed to use a path pattern relative to the module folder, as listed above? This would make a lot more sense to me, as I cannot predict whether the people will install my module in the "modules/contrib" folder, or in another subfolder, or directly in the "modules" folder (and if they install it from the Drupal UI, they may not even know it themselves).


texts: Allow user to edit commerce line item at checkout

texts:
I have a line item type with a custom amount field that allows the user to specify the amount they pay for the product in the add to cart form.

I also want to be able to allow the user to update the amount at any stage up until they have paid.

How can I make it so that users can edit this line item on the checkout page?

Ideally I would like to just have the equivalent of the add to cart form with my editable amount field output on the checkout page but I'll settle for any way to edit the line item on the checkout form.

I would like to keep custom code to a minimum but am willing to do whatever it takes if my only option is to go very custom.

If it matters to the solution, orders that contain this line item will only ever contain the one product, with quantity 1 and the variable price.

These orders use Commerce NoCart and Commerce Checkout Multilane to skip the regular cart step.

[EDIT]

An idea I just had was to create a custom checkout pane with my form on it and a submit function that updates the line other on the order. Does anyone see any reason why that wouldn't work?

Or does anyone know if something similar already exists that I could modify/extend faster than writing something new?


texts: How can I output a text string when my dynamically built form is empty?

texts:
I have a form that is dynamically built. It renders a list of check boxes, but sometimes there are none to render - it is empty. In this circumstance, instead of the forms #titles with nothing below them being rendered, I'd like to output t('None'). For the type #tableselect the option seems to exist: #empty, but not for checkboxes or any other type. How can I acheive this? Thanks.

Code added:

    // Form defintion.
    $form['posts'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Member responses to:'),
        '#options' => $options['post'],
    );
    $form['terms'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Posts tagged with:'),
        '#options' => $options['term'],
    );
    $form['groups'] = array(
        '#type' => 'checkboxes',
        '#title' => t('Group posts for:'),
        '#options' => $options['group'],
    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Remove'),
    );
    return $form;

I tried at the bottom:

if(empty($options)) {
  return t('None');
} else {
  return $form
}

...but this threw an error.


texts: Where are templates from hook_theme stored in the database

texts:
I have a module, called "bundles", there I created a file "attached_email.tpl.php" and a hook_theme:

function bundles_theme($existing, $type, $theme, $path)
{
    $path = drupal_get_path('module', 'bundles');

    return array(
        'attached_email' => array(
            'template' => 'attached_email',
            'path' => $path,
            ),
        );
}

I have 2 databases for this website: lwt (default) and lwt_test (for test data). I have written the template, cleared caches and imported test data into lwt_test DB. But the template is unavailable there. When I call:

theme('attached_email', $data);

From lwt database, it gives the output. But when I switch to lwt_test:

db_set_active('lwt_test');

nothing is given. I can only conclude, that there is some piece of data, stored in lwt database, missing in lwt_test database. And that's why Drupal doesn't see my new template.

Update

When I use this code:

print theme('attached_email');
db_set_active('lwt_test');
send_attached_emails($bundle_id, $users);
db_set_active();

It gives the correct result (probably the template is cached after the 1-st call).


texts: How to use prepareKey() for the Migrate module

texts:
I am trying to do write a migration class extending the Migrate module. The migration will be from an XML file so I will want to extend the XMLMigration class. Based on the Migrate modules wine.inc example, I'm going to have to something like this:

class WineProducerXMLPullMigration extends XMLMigration {
 public function __construct($arguments) {
  ....
  $item_xpath = '/producers/producer';  // relative to document
  $item_ID_xpath = 'sourceid';          // relative to item_xpath

  $this->source = new MigrateSourceXML($items_url, $item_xpath,
                                       $item_ID_xpath, $fields);
  }
}

My issue is that my xml doesn't have any unique ID per row, and therefore I can't really pass a $item_ID_path. I read this post https://www.drupal.org/node/1444356#comment-6974360 and found that the prepareKey() function is supposed to be used for this purpose, however as far as I can tell, you don't ever call this directly, and its called after this class is finished processing. This being the case, I'm not sure what I should be passing in $item_ID_xpath and it is a required field.


texts: View poll *results* as anonymous user doesn't allow access

texts:
Has anyone come across this problem before? When an anonymous user tries to view the current poll results (from the current poll block) they get an ACCESS DENIED error. However, if they view the poll (not the results) they can see it just fine.

For example:

http://cypress.supportedns.com/~actionin/node/11/results
(Access denied)

http://cypress.supportedns.com/~actionin/node/11/
(No problem)

In the permissions administrative page, I gave the Anonymous User access to view results, so I'm not sure what's going on. Any ideas? Thanks in advance.


texts: How to display instances of a field (field collection) in tabs?

texts:
I have a content type with a field which has a number of instances (actually, it's a Field Collection with a vimeo embed and a text field). I would like to have each instance of the field to be shown as a tab? Field Group seems like a natural candidate for this role, but from what i understand it enables me only to build tabs for particular fields, not fields instances.

The way I'd dream this functionality to be is:
1) I add another field to my field collection named, say, "Tab title"
2) In "manage display" of the node I set the display of the field to be of "tabbed instance" type.
3) In settings of this display I set the title of the tab to be the new field introduced in 1) by Token.
Of course, any other way of acieving the goal would be also most welcome.
Is there a simple way to obtain such a functionality?


texts:
I am looking for a People directory Search Module.
Something like what they used on top of the link: http://wws.princeton.edu/directory
Also in the link above, they have pagination on the top and
bottom of the page.
In my case when I set the 'Pager' in Drupal Admin, it adds the pagination block to the
bottom of the page. How would I move it to the top instead?

Thanks.
Boutros.


texts: change custom css class to block content

texts:
When I create new block drupal auto create this html tags and default css class for block content:

now i need to edit css/class like this:

It is possible? If YES, How To?


texts:
I'm trying to figure out what the best practices are for page layouts in Drupal.  Many pages have several different elements on them like main content, a header image, etc.  I'm not looking at creating a 'basic page' or anything similar (ie one node for the whole page).

Is it good to use panels for every page and them drop blocks into them?  I could drop views, possibly a node, a contact form, etc...


texts: $head variable - blank page after clearing caches (Clarified)

texts:
When I clear the caches I get a blank page because the page stops rendering after the $head variable in my html.tpl.php. This is then in the source at that point:

<script />

The rest of the page is there in the source after this tag; the page just doesn't show. If I add an ending </script> tag after $head, then the script is closed and the rest of the page prints out.

Any ideas? I just did not know what to search for.

EDIT: I did want to mention that I recently updated the site to 7.41 from 7.39 and also deleted some fields from a content type. Unfortunately, I do not know when this problem emerged in relation to these changes.


texts:
I have a number of "product nodes" that I'd like to return and display in a paged table.

The original query is generated as follows:

    $productNodeQuery = db_select('node', 'n')
    ->fields('n', array('nid'))
    ->condition('type', 'product', '=')
    ->extend('TableSort')
    ->extend('PagerDefault')
    ->limit($page_limit);

    $productNodes = $productNodeQuery->execute();

This returns all the products I want, however the pages are all messed up. Some pages have 3 items, some pages have 10, others have the full $page_limit (50) items per page.

I have a loop

foreach($productNodes as $productNode) {
....
}

to iterate over the results and add each product to the $rows[] array with this:

 $rows[] = array(
            'data' => array(
            'autoupdate' => $part['autoupdate'] == "1" ? 'ENABLED' : 'DISABLED',       // Display Checkbox?
            'part_number' => $part['part_number'],
            'title' => l($this_node->title, url($base_url . '/node/' . $this_node->nid)),
            'category' => l($this_category_name, url($base_url . '/catalog/' . str_replace(' ', '-', $this_category_name ))) . "
(Markup: " . $this_markup_percent['suggested_markup']*100 . "%)",
            'supplier_price' => $supplier_prices_string != "" ? $supplier_prices_string : "N/A",
            'suggested_price' => isset($suggested_prices_string) ? $suggested_prices_string : "N/A",
            'sell_price' => '$' . number_format($this_node->sell_price, 2),
            'competitors_price' => isset($competitor_prices_string) ? $competitor_prices_string : "N/A",
           'edit_node' => l('Edit Node', $edit_node_link, array('attributes' => array('target' => '_blank'))),
           'message' => "" . $row_message . "",
                ),
           'class' => array($row_class),
  );

Finally, after the $rows array has been defined with all the data I need I am building the table with this:

$form['table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => 'There are no product nodes found',
);
$form['pager'] = array(
    '#markup' => theme('pager')
);

Does anyone have an ideas as to where I'm going wrong with the pager?

(Full Form Code is available here: http://pastebin.com/bna1g1iV)

Thanks,


texts: How to know if my XML Sitemap being submitted?

texts:
I've configured the XML Sitemap and Site verification modules, but I don't see the sitemap being submitted to Google. If I enter the Google Webmaster tools it says no sitemaps were submitted, but maybe it doesn't show those posted via API or something.

How could I know if it's being actually submitted? Thanks.


texts: Is the path_alias table queried for all URLs?

texts:
I'm trying to generate SEO-friendly URLs for a set of exposed filters. For e.g.:

/analyst-relations/firm?related_firm=5072 would look like

/analyst-relations/firm/forrester

one way I imagined doing it was by adding/updating/deleting this path programmatically to the path_alias table upon creation/modification/deletion of the relevant term or entity. However I seem to have misunderstood how path_alias works. I was able to successfully add the path /analyst-relations/firm?related_firm=5072 and the alias /analyst-relations/firm/forrester, but the exposed filter links still load like the former. Is the path_alias table not queried for all URLs? If not, is it possible to somehow 'attach' this path and alias to an entity?

EDIT:
I'm using Better Exposed Filters to exposed the filters as  links, so afaik there is no form submission


texts: Show warning for viewing only some nodes

texts:
I am developing one website where I have one content type (News). Now, some of news content type nodes is adult and must to have age confirmation popup (just warning text, accept and decline button).

Any suggestion how to do that?


texts:
I was wondering — as I am unable to seemingly find the right keywords to search for — if anyone out there knows of an existing Drupal 7 function to do this. It seems like it would make sense for it to exist already.

Basically I have a form that already has a redirect value applied to it's $form_state — the construction currently is as follows. I do not have control of this value, it is set by LoginToboggan.

$form_state['redirect'] = array (
  'user/awaiting-auth',
  array(
    'query' => array(),
  )
);

However, I would like to step in and redirect to my own stop-gap page. After the form on that stop-gap page has been submitted I'd like the original redirect to occur. Obviously I can code this transformation, what I have currently is:

/// check to see if we would have had a destination
if ( !empty($form_state['redirect']) ) {
  /// if it's an array, then handle as array ( $path, $options )
  if ( is_array( $form_state['redirect'] ) ) {
    $dest = url($form_state['redirect'][0], $form_state['redirect'][1]);
  }
  /// if string, treat as path?query
  else if ( is_string( $form_state['redirect'] ) ) {
    $dest = $form_state['redirect'];
  }
  else {
    $dest = '';
  }
  /// build our redirect options
  $options = array(
    'query' => array(
      'destination' => $dest,
    ),
  );
}
else {
  $options = array();
}
/// recreate our redirection based on where we want to go now, and where we will go next.
$form_state['redirect'] = array( "node/{$form_node->nid}", $options );

Whilst this works, to a certain degree, there are two issues:

The redirect array containing user/awaiting-auth, when passed through url, is returned as /user/awaiting-auth. This is fine if used directly as part of a drupal_goto(). However, when fed back as a destination value, the ultimate location the user ends up at is //user/awaiting-auth. I could trim the prefixed / but this feels clunky.
I am currently handling different outcomes if the initial redirect value is an array or a string (possible values as far as I can discern). However, there may be other constructions I do not know about, or a future version of Drupal may change the redirect/url array construction; this would be where an exising Drupal function would be best.

What I'm looking for I guess is something like this:

drupal_chain_redirect( $destination, $old_destination );

Where $destination could be a string or array, and the same for $old_destination. It would return an array structure ready to be set to $form_state['redirect']. It seems like this would be a frequently occuring request when developing complex modules that may interplay and step on each others toes.

Any ideas?


texts: How to force entity translations to load in a certain language with user_view() or entity_view()

texts:
I have a custom view mode that uses a template to print out user profiles.

I am saving the HTML from this view mode in the Solr search index using Search API Solr.

In user--my-view-mode.tpl.php, I print out the various fields of the user profile, including one that is a taxonomy term that has been translated by the Entity Reference and Title modules:

  $agegroup = $user_profile['field_acc_age_group'][1]['#markup'];

In the Search API callback, I call this view mode like this:

$render = user_view($item, 'my-view-mode', 'ja');

Here's the problem-- the profile is rendered in Japanese except the taxonomy term, which has been translated by Entity Reference/Title.

When I make a view that shows output of Rendered User and set the view mode to my-view-mode, and access the view with a user who has the language set to Japanese, then the taxonomy term is translated correctly.

So how do I get user_view() or entity_view() to show translated entity translations along with the rest of the translated output?


texts:
In hook_views_query_alter(), I am trying to add a join to the user role of the author of the node and filter basing on the role.

        $query->add_relationship('user_role_join', new views_join('users_roles', 'uid', 'users', 'uid','INNER'), 'node');
        $query->add_where(1,'user_role_join.rid','4' ,'=');

It is something like this, but I am missing something. When I run this query the result is always empty. If I create the condition using Views UI, I do get the correct and expected result. So the data is okay, but my code is the problem.

How do I setup this join correctly in hook_views_query_alter()?

Also the following code doesn't work.

$join = new views_join();
$join->table = 'node';
$join->field = 'uid';
$join->left_table = 'users_roles';
$join->left_field = 'uid';
$join->type = 'INNER';
$join->extra = array(
            array(
                'field' => 'bundle',
                'value' => 'node',
            )
        );
$query->add_relationship('user_node_role', $join, 'node');

$query->add_where(1,'user_node_role.rid','4' ,'=');


texts: How to add another filter to Scald search?

texts:
I have added new field to the Scald Image atom admin/structure/scaldwhich is called description and it is text area multiple rows. Now I want to have this field in the search to be shown at the below screen shot.

I tried to edit the field by checking MEE Enabled but I could not get it in the search.


texts: Forms - Save Draft and unique user access code to Resume (on any computer)

texts:
Is it possible for the site users to get a unique access code, so that they can resume the form from any computer?

I am currently using the Webform module for its "Save Draft" feature and am wondering if it is also able to provide an access code ...


texts: How do I get items of a field of type list?

texts: I have created a list field with 10 items(allowed values). Now I want to get that 10 items programmatically. How do I get them?


texts: How can I override or disable a parent theme's CSS file?

texts:
I am trying to override the menu.css file in the default Classy theme through my library file. I have read through the documentation, but anything I tried doesn't work.

What would be the correct markup to override or disable this file?


texts: Can I make a Drupal Book page parent with no content?

texts:
Is it possible to Organize Drupal Book pages under parent pages that are just headings, are not links and have no content?

I want to separate pages under headings but I don't want to create pages for these headings, just to add text to the navigation and use as a parent for pages.


texts:
My Drupal 7 website has no layout (CSS and JS is messed up) and is getting the following error message:

  The specified file /tmp/filestW97L could not be copied, because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions. More information is available in the system log.

The /tmp/ directory at the root level has 777 permissions. I think the directory the error message is referring to, as there are files with similar names in it. I'm puzzled as to why Drupal cannot access that directory.

It does have 80,000 files in it. Could it be too full?

I'm assuming that /tmp/ is the "destination directory". Am I correct?

I'm on a VPS running Centos. The VPS has plenty of resources and I tried rebooting it in case that might help.

I don't think I did anything to cause this error, as it happened when I was not working on the website. Is it possible that a CPanel update from the past several days did it?

I cannot read the system log, as the admin user cannot log in (I get blocked by an anti-spam module that requires JavaScript enabled). Is the system log the same thing as the watchdog table?

I fixed the problem.  I did several things.  I think flushing the drupal cache was the solution that worked, but I am not 100% certain.


texts: How to make the File Attach option available?

texts:
When attaching a file to an instance of a content type, there is an option to use ‘file attach’.
This is an alternative to uploading a file to the server from one’s local computer. Instead, when creating the content, you click on File attach option and it shows the contents of the folder sites/default/files/file_attach.

but i don’t remember how to get this option to be available! does anyone know?

this is much more efficient than uploading files from my laptop to the server

thank you,


texts: Display a picture from an article related to a product

texts:
This is the scenario:
There are multiple products (paintings). Each one of these paintings has one author, which is defined with a content type.
There is a reference field form the product to its author.
The view picks the author image in the FIELDS section, a relationship had to be set for this.
So far, so good. This displays all author pictures.
The contextual filter
This is where I'm having trouble. I choose ID (that is the product's ID), which is supposed to be in the URL and that way the filter would be applied but it does not.
As a matter of fact, there is no possibility to choose the product's ID as the contextual filter. Edit: The product ID is there, and the the View works now in Views UI, when testing. But it displays the wrong picture in the Product display.

And it is because of the URL, Pathauto generates this type of URL:
mysite/kunst/69?v=79

where 69 is the product ID.
Where does this ?v=79 come from?
If I navigate to the product's admin screen, the link will be correctly displayed on the bottom left part of the browser window, and if I only provide the URL: mysite/product/product_id, the product gets correctly displayed, but the View does not take effect, meaning, it gets displayed, but the right picture has not been filtered out correctly.
Has someone an advice to put me in the right direction.


texts: How do I programmatically render a custom entity?

texts:
I created a custom entity (submenu) in Drupal 8. I need to render this custom entity in my custom module. This is the code I am using.

$entity_type = 'submenu';
$entity_id = '1'; // static for example purpose
$view_mode = 'full';

$entity = \Drupal::entityTypeManager()->getStorage($entity_type)->load($entity_id);
$view_builder = \Drupal::entityTypeManager()->getViewBuilder('submenu');
$pre_render = $view_builder->view($entity, $view_mode);
$render_output = render($pre_render);

I keep getting the following error.

  TypeError: Argument 1 passed to Drupal\Core\Entity\EntityViewBuilder::view() must implement interface Drupal\Core\Entity\EntityInterface, null given

Why do I get this error?


texts: How to force child page added to book outline to top or bottom; update outline without clearing cache

texts:
Drupal 8. When you click the "Add child page" link at a book page, you go to "/node/add/content type" where you can create and save the child page. Upon return to the book page (assuming the book navigation block is being used to display the book outline), the newly added child is not displayed (usually) in the outline until the cache is cleared and the page refreshed. Children are displayed in alphabetical order by default.

This is challenging for content editors who enter child pages because they don't see the child they've just entered when returning to the book page, and when they do see them, the children are not listed in the order of entry.

Is there a way to:

Automatically clear the cache upon leaving the add child page? Or disable caching for the book navigation block, at least for users with certain roles? Or something else to allow the editor to see the added child?
Automatically add the child page to the top or the bottom of the book outline? Possibly by passing a weight (in the query string?) to the add child page that's placed in the "Weight" field in the Book Outline tab at the right? (Note that the parent node id IS passed via the query string and inserted into the Book and Parent item fields in the Book Outline tab.) Or something else so the editor will know where in the outline to look for the newly added child page?

To this second question, one might say, "Just have them enter the weight when creating the child page." This works fine until they drag to reorder the outline. When that happens, Drupal assigns weights beginning with -15 to the child pages, so editors aren't sure what weight to enter.

Just trying to make the process of entering child pages for books as simple as possible so there will be fewer mistakes (especially same chapter added twice, or not at all).


texts: Conditional fields on content type with paragraphs

texts:
I saw this question repeat in a few places without an adequate answer.

I have a D8 site that has a certain contain type ('deals') which contains an array of 'deal' paragraphs.
Each 'deal' contains a 'deal_type' field and then a few content fields ('image', 'text', 'banner', etc.).

I would like to conditionally show the paragraph fields, according to what the user selected in the 'deal_type' dropdown.

I saw some answers mention a MODULE_form_alter() hook but this didn't seem to be called when I load my 'edit content type' page.

Can anyone help with this?


texts: How to create a view of unread comments on own nodes for the user's profile page?

texts:
I'd like to create a view for the user's profile page that displays all unread comments on the nodes he/she created. When I say 'unread', I mean that the page where the comment is situated (namely, the node's page) hasn't been visited by the user yet. In other words: when the user hasn't read a new comment, it will be displayed in the view; once the user has read it, it will disappear in the view.

I've already set up a view that simply displays all comments on the user's nodes, but I can't find an extra 'Filter criteria' or 'Relationship' that filters out the unread ones.

Can you help me?

Edit: I created a flag called 'Read' ('Reactie gelezen' in Dutch) with the Flag module and a rule 'Comment read' that automatically flags comments with 'Read' when they're viewed. I've also granted every user the permission to flag comments with the 'Read' flag (although they won't see the flag links above their comment of course).

My rule works perfectly and the flagging works manually too. The view however, doesn't work properly. These are my settings:

Both uid's were provided the default value 'User ID from URL'.

What did I do wrong?


texts: No emails being sent when using User Registration Password set up

texts:
When a new user registers with my website it displays "Thank you for applying for an account. Your account is currently pending approval by the site administrator.
In the meantime, a welcome message with further instructions has been sent to your e-mail address."

However, no email is sent from the site at all.

I have my settings so that approval is required from the administrator before the user can be activated. Also, they set their password up on the registration screen.

Im using v1.4 of the User Registration Password module, and Drupal 7.41

Could someone let me know why no emails go to the administrator or the users ? Emails were being sent without the module installed, but I really want users to set their password up front.


texts:
I am trying to make the Header and Footer zones a little narrower than the Content Zone in Omega3 & Delta.  Here is an example of how it should look:

How can this be done with Omega3?


texts: How can I tell drush to use another php.ini file?

texts:
I've gone through the setup instructions on https://github.com/drush-ops/drush, but I can't seem to get drush to use a different configuration file, very frustrating.

I've already added the PHP_INI environment variable to my .bashrc and sourced it, seems like there is something I'm missing.


texts: Need help changing out theme based picture on front page, can only be done through host site, not admin panel

texts:
I have been taking care of the basic updates on a website for an old friend.  I can do everything through the admin panel except update the main picture on the front page.  You can see it at www.foxviewfarms.com.  It is running Drupal 7.0.  I do know this can only be done through the host site, but I am just a rookie self taught person...I have never done anything like this.

I do understand I should backup before any changes.

So from the host, I found two places that the home image resides.  The first pic here shows my folders.  I went into the public one:

Now I pointed to the two places I found the image and I circled its file name.  It would seem to me that I would upload a new picture to each folder, then delete the old picture that resides in the sites/all/foxview/images folder (while keeping it in the themes/foxview/images in case I want to use it again).  The themes/foxview/images folder has the current image and past images, while the sites/all/foxview/images folder has just the new image.

Am I looking at this right?  Is there anything else I would need to change to update this picture?  Any help is greatly appreciated.


texts:
How can I redirect users to a node in a form submission handler similarly to the following code?

In my form alter I have added an additional submit button:

$form['actions']['save_and_exit'] = array(
    '#type' => 'submit',
    '#value' => t('Save & Exit'),
    '#submit' => array('custom_submit'),
  );

function custom_submit(&$form, \Drupal\Core\Form\FormStateInterface
  $form_state) {
    $system_path = '/node/2';
    $url = \Drupal::service('path.alias_manager')->getAliasByPath($system_path);
    $form_state->setRedirect($url);
}

Then I'm getting following error:

  Symfony\Component\Routing\Exception\RouteNotFoundException: Route
  "/mypage" does not exist. in
  Drupal\Core\Routing\RouteProvider->getRouteByName() (line 190 of
  C:\wamp\www\www_assure_local_com\core\lib\Drupal\Core\Routing\RouteProvider.php).

where /mypage is the url alias of my /node/2.


texts:
I have a docroot with 2 websites, both share core and contrib modules.
I have 2 DB, one for default and another for subdomain.
Inside "sites" folder also have 2 different folders:

default
site2

My sites.php
//Site1
$sites['dev-site1.com'] = 'default';   // dev
$sites['test-site1.com'] = 'default';  // Test
$sites['site1.pt'] = 'default';        // Prod
$sites['local-site1.dd'] = 'default';  // Local

//Site2
$sites['dev-site2.com'] = 'site2';    // dev
$sites['test-site2.com'] = 'site2';   // Test
$sites['site2.site1.pt'] = 'site2';   // Prod
$sites['local-site2.dd'] = 'site2';   // Local

On server certificate I have a wildcard *.
Locally both sites work fine, but on acquia server don't.
If I open dev-site1.com on incognito mode works fine, then I close incognito window, open a new incognito window and open dev-site2.com also works fine.
If I open incognito window with dev-site1.com and then I open new tab with dev-site2.com doesn't work, it seems to redirect both sites to one of them (random redirect, sometimes open dev-site1.com on both domains and another ocasions open dev-site2.com in both domains).
On server console when I run "drush status" everything is well defined, pointing to correct DB name, user, pass etc.
Is anything I am missing when upgrade for Drupal 9?
My Test env is with Drupal 8 and everything works as expected.
Thanks in advance.


texts: Linking terms to views instead of taxonomy pages

texts:
I have created a view for movie genres, with contextual filters to generate such pages as /horror, /comedy, etc.

When I tag content or users, I want the links which then appear on these pages to refer to the view. Right now they go to the term page.

I have heard that the TVI module is the way to go, but I can't find any documentation about it.

I don't even want these term pages to exist at all - I have essentially made my own, to my own specs. How can I make this happen?


texts: Add multi-level taxonomy term selection field with multiple selection for last level

texts:
I want to add field with taxonomy term selection
If suppose I have vocabulary as Food and it has hierarchy of terms like below:

Fruit
- Mango
- Apple
- Banana
Vegetables
- Spinach
- Potato
- Tomato

While selecting taxonomy terms in a node I want to first select Fruit or Vegetables and after that another select list should appear with provision to select multiple sub terms for respective top level terms

Example: If I select Fruit from first select list only single selection allowed and then second select list should appear with Mango, Apple, Banana so one should have chance to select multiple fruits from second select list

I tried simple hierarchical select but it doesn't give provision to select multiple terms on last level field.


texts: How do I retrieve a plugin block field's translated value?

texts:
I created a module that installs a block with some fields when installed. I added a schema file, and altered the blockSubmit() function so that the translation is saved in the schema.
Here is my module.schema.yml:
block.settings.worldwide:
  type: block_settings
  label: 'Worldwide'
  mapping:
    overtitle:
      type: label
      label: 'Overtitle'

Here is the blockSubmit() function from my Block plugin:
public function blockSubmit($form, FormStateInterface $form_state) {
    parent::blockSubmit($form, $form_state);
    $values = $form_state->getValues();
    $block_name = $this->getPluginId();

    $this->blockConfigFactory->setBlockConfig($block_name, 'overtitle', $values['overtitle']);
    $this->setConfigurationValue('overtitle', $values['overtitle']);
}

When saving, I have no error, and can translate the field, which will keep the translation when updated. So everything seems to work. Additionnally, the website displays correctly what I saved for the default language.
Now, let's say that the default language is english and the alternative is french. My issue is that if I set the website in french, the default (english) value will keep displaying.
However, I can't figure out a way to displayed the saved translation when I want to look at the block in a language that has the block's translation saved. I have no idea where to look, and can't seem to find relevant stuff on internet.
Thank you in advance


texts: Set block content from panels / page manager?

texts:
I am configuring a panels page manager page which also should have a specific sidebar block (search filters related to the page content).

I want to use the regular page.tpl.php where the sidebar is a theme region with blocks. This means the block would NOT be part of the panels layout. I am doing this so that I can get the regular page title and other decorations.

I know that in Display suite it is possible to move some fields into a dedicated region that will be displayed as a sidebar block.

But does something similar exist in panels?

Other options would be to use context module, or to use the regular blocks UI with visibility settings. But in this question I am asking specifically about a solution in panels / page manager.


texts: Translated default values when using paragraphs

texts:
I've set default values for a paragraph field for each language on my site, but when creating language pages, it only ever shows the english version.

I can set the default value manually by setting $element['subform']['field_component_about_us_text']['widget']['0']['#default_value'] = "Default Text"; within publication_field_widget_form_alter , but I'm not able to get the translated default values from the paragraph definition.

Any idea where I'm going wrong?

Thanks,

Luca


texts: Why do many functions now require more code than the equivalent functions of the previous version?

texts:
Every time I read about how to convert code from D7 to D8 is seems like the D8 version is longer.

For example drupal_goto was:

drupal_goto('user');

and the D8 equivalent is:

return new RedirectResponse(\Drupal::url('user.page'));

And an example hook_init in D7:

function mymodule_init() {
  if (!empty($_GET['redirect-me'])) {
    drupal_goto('http://example.com/');
  }
}

And the equivalent is D8 is:

mymodule.services.yml

services:
  mymodule_event_subscriber:
    class: Drupal\mymodule\EventSubscriber\MymoduleSubscriber
    tags:
      - {name: event_subscriber}

and then also:

namespace Drupal\mymodule\EventSubscriber;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class MymoduleSubscriber implements EventSubscriberInterface {
  public function checkForRedirection(GetResponseEvent $event) {
    if ($event->getRequest()->query->get('redirect-me')) {
      $event->setResponse(new RedirectResponse('http://example.com/'));
    }
  }
  /**
   * {@inheritdoc}
   */
  static function getSubscribedEvents() {
    $events[KernelEvents::REQUEST][] = array('checkForRedirection');
    return $events;
  }
}

This is only a couple of examples but it seems that to achieve anything is D8 is going to take far more code.

Is this actually the case or am I misinterpreting whats happening.
If this is the case then what is the advantage?
Would it be possible / desirable to use lots of wrapper functions to reduce the amount of code to achieve simple tasks?


texts: How to disable a module dependents module? Not the module but the feature

texts:
Hello I have the module BEF better exposed filters installed and enabled and together with it is the BEF Test Content module (feature of BEF better exposed filters moduke).

I just enable the features so BEF Test Content for making tests and now when I want to disable it shows on the screen like red and when i try to disable and save configuration... i can not...

also i tried through drush by using:

drush dis better_exposed_filters

but logically it says that it will disable the BEF Test Content module extension but also it will disable together with the BEF Better exposed filters too...

is there a way to disable only the dependent module? how about with drush?

thanks!


texts: How to modify existing language's language code?

texts:
We have found a typo with one of our language codes. We already have content within that language, but would it be possible to update the language code without having to delete/remove the language and then reading it back in?

WE are unable to find a good way to do modify just the language code..


texts: Location Contextual Filter: Distance/Proximity

texts:
I am trying to create a location-based contextual filter, and it seems like it should be taking four arguments - Lat, Lon, distance (number) and distance (unit).

How should this filter actually be created in the URL? I'm trying the following format:

42.279594,-83.732124,25, 2, miles

and getting nothing.

Would I just create a url with four arguments? Like location/%/%/%/%?

I've never used a contextual filter with multiple arguments before.


texts: Explanation of pear's include path, and why Drush cr clears it?

texts:
I got an error message when trying to import Drupal configuration with drush cim, saying the following:

include_once(/var/www/d8site/modules/custom/somemodule/somemodule.module):[warning]
failed to open stream: No such file or directory Extension.php:140
include_once(): Failed opening                                       [warning]
'/var/www/d8site/modules/custom/somemodule/somemodule.module' for
inclusion (include_path='.:/usr/share/php:/usr/share/pear')
Extension.php:140

The somemodule.module file was deleted between versions, but it's still expecting it.  Restarting and/or reloading Apache didn't get rid of this message, but drush cr did.  I don't want to have to clear the entire Drupal cache on production, so how could I update this include list without clearing all cache with drush?  If I didn't have pear installed, would this be any different?


texts: CPU spike during image multiupload — how to optimize performance?

texts: I have an image gallery that allows users to upload a huge number of images at a time (this was a project requirement) and when an upload happens, the server's reported CPU usage spikes to 1000%. What modules, settings, or other modifications can be used to ease the load on the server or throttle the image processing (without delaying the loading of the next page so users don't think it's hanging)?


texts: How to Show Multiple field value according to Row Height

texts:
In Content type Having field Work Images and enter the content for that and set the relationship  and CONTEXTUAL FILTERS for the frontend.
Content Is showing fine But its showing random.
How can I show the value as in same order as in backend ?
Any Suggestion ?


texts: How to link Images of one node to other node?

texts:
I've created a content type of image.

I am using a view to display the images on the homepage. I would like each of the three images to link to existing pages/nodes (not the nodes of images themselves).

I want to link images of node a to node b is that possible ?

How would I go about doing this?


texts: is it possible to populate subclass of FieldItemList from code?

texts:
The context first:

I'm migrating a website from D7 to D8 and one of the modules has no update on D8.
I found an alternate module with the same functionality.

For the FieldType of the alternate module, it consists in a subclassOf FieldItemList, lets say MyFieldItemList and a subclass of FieldItemBase, lets say MyFieldItemBase.

I'm quite stuck on this:

I exported the data from D7 using views and a csv generation export
I'm creating a micro Drupal 8 module to upload csv file and populate existing nodes with csv data
I can get the subclass of FieldItemList from my node and saw the "append(...)" method in documentation.
I can't manage to find how to create a new item of type MyFieldItemBase

I can't find any examples in existing modules and over the web, is there a flaw in the import process I wanted to follow?


texts: Views contextual filter not working for Pathauto path

texts:
Im using Pathauto so set aliases for taxonomy terms.

So this:
/taxonomy/term/1

Is the same as this:
/custom-term-url

Im using Drupals default Taxonomy term View to control the layout of the term page. This works fine for both of the paths.

Ive created an additional page in this view with a path of /taxonomy/term/%/something and an additional filter so show different results.

When I go to this page everything works perfectly:
/taxonomy/term/1/something

However this returns a page not found:
/custom-term-url/something

How can I get my View working with the Pathauto URL?


texts: Creating a menu while categorizing my products

texts:
Hello I am developing an e-commerce website with drupal commerce(commerce kickstart) everything seems great.I have imported my products and I have tested it and I made my catalog like the video on vimeo that it is posted http://vimeo.com/22748684.

But I would like to make this catalog as a drop down menu.I mean I want to a menu with jquery  that it will replace this catalog and the user for example can see a subcategory cars and can choose Toyota, BMW, some other with tyres like my products on the catalog.

How can I do this?


texts: Pulling WordPress Featured Images using Aggregator to Display Them

texts:
I'm using Drupal 7's Feed Aggregator to pull WordPress posts. I have a block with a view displaying these posts (3 of the most current rss feed items). My question is how can I pick-up WordPress's featured image of a post to display as a thumbnail of the Drupal RSS item?

I have edited the RSS Settings to include the  HTML tag to the list, but it only pulls images inside of a post, rather than a featured image of a post.

Is there a way to achieve this using the RSS Aggregation module?

Conversely, on the WordPress website I'm using this plugin to add featured images to the RSS feed and looking at the feed XML, is it displaying the featured images as well as post images.

Any insight would be appreciated!


texts: Showing only one of the Field Collection fields through Views

texts:
I created a Field Collection field for a content type. This FC has two fields inside: an image field where I can upload unlimited number of image; and the other one is the title field to be used as a caption for these images.

Now the problem arises when I try to view this content type through Views where I can not modify each FC field but the whole FC. For example, if I had a content type with an image and a title field in Views I could manipulate the image field controlling the image style, the linking if the image links to the file or nothing etc. But since I use FC I can not access the image field settings anymore through Views.

The reason I want to manipulate the FC image field is that I want to use Colorbox inside my image gallery. But first I want to link all these images shown through Views to the node of each image gallery and then I want it to be seen with Colorbox.

Note: I tried to use in the FC settings Output this field as a link but it links only from the title field of FC not from the image field and, as I explained above, I can't manipulate the image field to make it have these settings.

Can someone help me out with this problem?
Thank you!


texts: how to save uploaded file in a custom user registration webform in D7?

texts:
I implement the myModule_webform_submission_insert($node, $submission) {...} function in my Module.
It's a regestration webform so I want to save all the data from the webform into a the new user. The user has to upload a file during the registration. I have no idea how to save this file in the user as in $submission[15]['value'][0] I only receive a integer. I have no idea how to get the path the file was actually saved.

Can somebody tell me if it's possible to save the file (uploaded with webform registration form) in the $user_data Array which is the parameter for user_save()?

For example I have this

function blabla_webform_registration_webform_submission_insert($node, $submission) {
// $node->nid will be the node id of your webform
if ($node->nid == 22) {

$submitted_data = $submission->data;
//Get data from field
$file = $submitted_data[15]['value'][0];

//Now $file has the value
// $file[value][0] = 46

}

What can I do with '46'? :)

Best regards,
Christian


texts: How to get alter value of a views field programmatically

texts:
I've developed a Views field plugin that extracts the value from another field in the view in order to apply some math. The plugin works great at getting the original value of the field. However, I would like users to be able to get the rewritten value of a given field. I've been searching around, but can't seem to find any documentation on this.

With the following code I can get the value of another field:

public function getValue(ResultRow $values, $field = NULL) {
  parent::getValue($values, $field);

  $field = $this->options['data_field'];
  $value = $values->_entity->get($field)->value;

  // I have some logic here that's not necessary for this question.

  return $value;
}

What would I need to do within the above function to get the value of $field if $field had been rewritten via someone checking the "Override the output of this field with custom text" checkbox?


texts:
I have created a block named 'xyz'. I also created a form whose id is 'form-type-node-form' and i want this form to display in that block. How can i do this?
please help me to get solution.


texts: How can I check in Rules if the number of members is below 50 or not?

texts:
I need to add some user points to users when they signup to the site. Using the Rules module I already provided that functionality. But problem is to add some less points after 50 members have signed up.

So how can I implement a condition to differentiate the people that are registered:

first 50 members means Sign-up (first 50 = 20,000).
after 50 members add 3000 points to user signup .

Anyone suggestions?


texts: How do I setup multiple sites with one database in Drupal 7

texts:
My hosting provider limits the number of databases.  I would like to setup several small sites with their own theme, modules, etc.  The scripting for setting up drupal sites from my host provider uses simplescripts.com but when I go to do an install, only Drupal 5 has the table prefix option.  Drupal 6 and 7 installs do not allow the table prefix.

I found this good reference, but it wasn't explicit as to whether or not the Drupal version mattered.  How do I get Drupal to use table prefixes so I can install multiple drupal installations in the same database schema?

I guess I don't see how to add the table prefixes to a particular install after the simplescripts.com has made the initial installation.

Is it even possible to setup multiple sites in Drupal 7 using one database? If so, is it a matter of using the simplescripts.com to install the files and then moving the installed files to the location I need them to be in? or must I install Drupal 7 manually for each site?


texts: Fatal error: Call to undefined function file_save()... while uplaoding user picture programatically

texts:
I have two drupal 7.x sites, and I am uplaoding user picture programtically using the bleow code. In one site it is working fine and another one is getting fatal error as shown below. what could be the problem here..

Fatal error: Call to undefined function file_save() in /...

Code to upload user picture programatically.

$tmp_photo_realpath = "images/".$userimgname;
        $tmp_photo = "images/".$userimgname;
          $file = new stdClass();
          $file->uid      = $uid;
          $file->status   = 0; // mark the file as temporary
          $file->filename = basename($tmp_photo_realpath);
          $file->uri      = $tmp_photo;
         // $file->filemime = image_type_to_mime_type(exif_imagetype($tmp_photo_realpath));
          $file->filesize = filesize($tmp_photo_realpath);
         $infofile = explode("/",$tmp_photo);
        $infoext = explode(".",end($infofile));
        $imgext = end($infoext);

      // The file should be an image
      $errors = array();
      $errors += file_validate_is_image($file);
      $errors += file_validate_image_resolution($file, variable_get('user_picture_dimensions', '100x100'));
      $errors += file_validate_size($file, variable_get('user_picture_file_size', '30') * 1024);

      // Make sure file extension is a valid image
      if (!in_array(strtolower($imgext), array('jpg', 'png', 'gif'))) {
        $errors[] = ' invalid image file extension.';
      }

      if (count($errors)) {
        drupal_set_message(t('Profile Image Import:') . ' ' . $errors[0], 'warning');
        // Clean up (set fid to avoid error messages)
        $file->fid = 0; file_delete($file);
      }
      else {
        // We'll need a valid file id on the file object; file_save() will give us one
        $file = file_save($file);
        // Update user account (fid is not empty, status is temporary -- image
        // will be moved to proper directory and assigned to the user)
        $fields['picture'] = $file;
        $account = user_save($account, $fields);
    }


texts: How to write inner subquery in db_select() method?

texts:
How can I write a subquery in Drupal 7? My query is the following:

SELECT N.nid AS n_nid
FROM   workflow_node WN
LEFT OUTER JOIN node N
ON WN.nid = N.tnid
WHERE ( WN.sid IN (SELECT WT.sid
  FROM (SELECT sid,
    Concat(',', roles, ',') AS role_stamp
    FROM workflow_transitions) AS WT
  WHERE  role_stamp LIKE '%5%')
AND N.language = "en" )


texts:
I'm looking for a way to add custom JS to the CKEditor instance that is being created by the WYSIWYG module.

I posted a feature request on the WYSIWYG module's issue que, but sun suggested I post here as well. http://drupal.org/node/1126656

If you're wondering about why I want to add custom JS, the reason is so that I can adjust WYSIWYG input to more accurately reflect the WYSIWYG output.


texts: update order status after order creation

texts:
i try to update status like this

function module_order($op, &$arg1, $arg2) {
  switch ($op) {
      case 'update':
      $money = 'Cash';
      if (isset($arg1->custompane) && $arg1->custompane == $money) $arg1->order_status = 'completed';
      break;
    }
}

It does not work.

What do I do wrong?


texts: Problems with view containing data from an entity reference on the current user user profile

texts:
Say I have a content type of Fruit, and I have nodes of this content type with titles "Apple", "Pear", "Banana". Then on a user profile I have a field of type Entity Reference (unlimited values) to nodes of type Fruit, so an individual user might have an entity references to "Apple" and "Banana" in this field.

I want to create a View which is a table, with each row being a fruit, and then an indication in the row (a tick or yes or whatever) if the current user has an Entity Reference to that fruit on their user profile.

I have created a Relationship (Entity Reference: Referencing entity) in the view to the Entity Reference on the User record. However, if I then add a "User referencing Content from field_fruit" field to my table, it returns a list, i.e. "Apple, Banana" on the Apple row and the same on the Banana row. This wouldn't be a problem except if there is no result it doesn't return an empty result, rather an empty list of nothings, i.e. ", , ," - which doesn't count as an empty result.

Is there any way I can fix this?


texts: Certain fields are disabled while editing a node

texts:
I created a page named "welcome"; when I try to edit the contents of the page when logged in as admin (uid=1), I find that the "input format," "menu settings," "revision information," and "comment settings" fields have been disabled.

Could anyone help me with how to enable these fields?

I am using Drupal 6. It is not a fresh install.


texts: Asking for confirmartion on node creation

texts:
I want ask for confirmation if a duplicate node is getting created. But how do I do it?

I know how to do it if I'm creating the form myself but in node creation I'm not creating the form.

I also know Drupal confirm_form, how "storage" is used in multistep forms. But how to use it along with the code which is not mine. Where to plug it?


texts: How to remove text from the body field in views and leave only  tag?

texts: Good evening, i have articles that contain texts and images, i would like to know if there is any way in views to strip or remove the text from body field leaving just the img tag, i don´t want to use image field module.


texts: Adding Theme Suggestions Programmatically For Views (Rows & Fields)

texts:
For a site I'm currently building I've got a variety of views, all with multiple display modes for different pages.

For example, I have a venues view, one block is named listing which lists all of my venues content type. I have another block which has some more specific contextual filters.

My issue is, this different block is styled the same, and has the same markup as my listing block so I don't want to have to duplicate my Twig templates for the rows and fields, for each display mode I have.

What my idea was is to add a function to my .theme file that would allow me to list display modes for a certain view, and add a single theme suggestion off that back of that. This way I can rename my Twig templates, and re-use the same ones for row and field level, on as many display modes as I'd like.

As I'm not using a theme suggestions alter hook, I'm not sure how I actually add theme suggestions.

Here's what I've got so far:

/**
 * Theme suggestions for views.
*/
function spve_preprocess_views_view(&$variables) {
  $view = $variables['view'];
  $id = $view->storage->id();

  // Venues
  if($id === 'venues') {
    // Venues grid
    switch($view->current_display) {
      case 'single_occasion_type_listing':
        $suggestion = 'views-view--venues-grid';
        break;

      default:
        $suggestion = null;
        break;
    }
  }
}

Obviously I'd need to replace either $suggestion with the correct function to add a theme suggestion, or add a bit at the end of my function to add a theme suggestion based of my $suggestion variable.


texts: Redirect user to prefered language after login

texts:
After any user logs in, I want to show all users the same page, but in their prefered language. So, I want to redirect the user to the page URL with the language appended, like http://example.com/pt or http://example.com/en.

What is the best way make this redirect?


texts: What do I need to install to run Drush make?

texts:
I want to make a site using a drush make command.I have already Drush installed on my server.
When I try to run this command: drush make --prepare-install martplug-build.make mart plug I receive this message: The drush command 'make martplug-build.make martplug' could not be found.

Should I also install Drush Make? If so how to do this?


texts:
I have an image field which lets the user input as many images as they want. (set allow number of values to unlimited in field settings) I'm creating a twig template where i want to loop over these images and apply specific style if it's the first image or set a different style if its any other image.

I know I can use {{ file_url(node.field_home_hero.entity.fileuri) }} to get the url of the image in an image field. I'm trying to get this for every image in my field now though which is proving to be a challenge.

I'm curently iterating over the field in twig as so:

{% for image in content.field_field_name %}
  {% if loop.first %}

  {% else %}

  {% endif %}
{% endfor %}

But doing the above does not load up the images for me. I know for sure I'm messing up with the access somewhere but not able to figure out what i'm doing wrong. If someone could point me to the right direction that would be great!


texts: Nexus theme slider is not showing up when logged out

texts:
I gradually found that if I comments the following code in custom. css, it shows up.

Any clue what is wrong here.. Any help is appreciated

I faced the same issue, and realised the issues in custom.js
I commented the following code in custom.css and slider showed up

 /* jQuery('#main-menu > nav > ul').mobileMenu({
    prependTo:'.mobilenavi',
    groupPageText: Drupal.t('Main'),
    topOptionText: Drupal.t('Select a page')
  });*/


texts: How to make user profiles searchable and filterable by multiple fields in the context of a job site

texts:
I'm currently in the process of developing a job search site hopefully with these abilities for users of the site:

Job seekers can search for and filter jobs. I'm on my way with this so no problem here.

However what I would like to do is create users searchable for employers. So users can sign up and fill in a number of fields, expertise, CV, skills or whatever else...

Then I want users with paid employer accounts to be able to search and filter employees by these fields.

I'm fairly new to Drupal and I was wondering how I would go about doing this?


texts: Using hook_mail_alter() for pending approval admin does not make any effect

texts:
I want to disable the emails sent to admins when a new user account is being created, Account details for (user name) at site name. (pending admin approval).

I tried adding the piece of code in the hook_mail_alter function but that does not give me any change. Below is the code change that i made

function hook_mail_alter(&$message) {
  if ($message['id'] == 'modulename_messagekey') {
    if ($message['id'] == 'modulename_register_pending_approval_admin') {
      $message['send'] = FALSE;
      return;
    }

    if (!example_notifications_optin($message['to'], $message['id'])) {
      // The usual code for sending mails.
    }
  }
}

Please let me know how can i disable the emails sent to admins.
I could not find any place where I can disable the email functionality from the UI end.


texts:
I need something which could seems a little strange, but it's a client request...

I have a site selling products using the Commerce module. All is working fine.

I need to allow the visitor to request a Discount Coupon in the following way:

The buyer see the full display for the product.
The product has a price of: 10,00 $
Bellow the price there is a form to allow the visitor to request a Discount Coupon
This form has 2 fields: one is email and the other one is called: 'I want to pay'. The visitor enter the price he/she wants to pay: 8,00 $ and the email.
The form is sent and some calculation are done based in: if the value of 'I want to pay' is >= than the price of the product (10,00 $). Then the condition is true and the visitor receive an email with a Discount Coupon
The buyer enters this Discount Coupon and pay 8,00 $ for the product.

Can I do this with Rules and Commerce Coupon. Do I need some other module?


texts: How to change field cardinality per form either programatically or by rule?

texts:
I've a multipage form (where each page is determined by field group) where on the first page user type number of people in text field and on the second one I would like to show X number of field collection instances based on the given number. So if user selects 5 people, I expect to see 5 field collection placeholders to fill for the user and no more Add another item buttons (especially when field cardinality is set to Unlimited).

Is there any solution which can achieve setting up cardinality per form state by a rule or from the code?


texts: Strategies for approaching a client requirement to create quizzes

texts:
One of my clients requirements seems to stretch Drupal's boundaries, and is forcing me to think differently on how to approach a problem. I am looking at potential alternatives and strategies to the following requirement so that I can get it right:

My client essentially wants to be able to create quizzes. We are unable to use the popular quiz module since it does not have a Drupal 7 version out yet and in any case, does not allow for multiple questions to be inputted in one go. Explored other module alternatives such as Closed question but they aren't exactly user-friendly.

Getting my hands dirty, my strategy around this is built as follows:

Create a new content type and have it powered via Web-form. The editors can now create questions using the web-forms following an instruction manual about the specific form elements to use. The question set essentially includes : - markup for questions
Radio buttons for option fields with the selected one denoting the correct field
Feedback field The entire question set is put into a fieldset. Subsequent question sets are created by cloning the first fieldset and once done composing, what we have is a node with webform elements that have been structured to appear as a quiz.
The problem:

The editors must follow an instruction manual in order to compose these question-sets and essentially the quiz since they are leveraging the webform. This is also in many ways a pseudo quiz, in the sense, I am leveraging web-forms to simulate what a quiz would appear like and not in essence a quiz. The process is tedious because for each question-set composed, the editors need to click each of these elements and have to fill in data making the process time consuming.

My ideal solution would be to have a content type that would allow the editors to specify a total number of questions in a content type and then have it generate the question-set(question markup, answer options as radio buttons, feedback). This would allow editors to quickly bang in the required content and in the process quickly compose quizzes.

Essentially the question is, if anybody knows how to achieve the ideal solution and if it is actually possible. If not, looking at the problem I have described, what alternatives are possible?


texts: Add radio buttons and text field together to theme-settings.php

texts:
I want to integrate a CSS switcher into my theme, but without the Color module. So I want a radio button list, (or a select list, or dropdown, doesn't really matter), with a list of different styles, and then I also wanted a 'Custom' option, so that the user could input a hex code instead of picking a style.

I know how to create a radio list, but how can I add a 'custom' text field too? Any ideas?

And then... what would go in page.tpl.php if the user has selected 'custom'?


texts:
I'm using drupal pagination here i have add some part of my code pagination is working perfect while I'm trying to get the total no of record it is always displaying 10. As i understand i have set the limit 10 so it displaying only total 10

$query->orderBy('r.published_date', 'DESC');
        $pager = $query->extend('Drupal\Core\Database\Query\PagerSelectExtender')->limit(10);
    $results = $pager->execute()->fetchAll();

This $results variable I'm getting data with the set of 10 values.

I would like to display total no of data for that i have created other variable where i have directly executed query in $result so it could give total no of records but its not working it displaying only 10

$result = $query->execute();
        while($data = $result->fetchObject()){
           $count_ret[]=$data->published_date;
        }
             $total=count($count_ret);

please  guide me where i'm doing wrong


texts: drupal_add_js doesn't 'stick' outside of hook_js_alter and hook_page_alter

texts:
Putting together a module that needs to insert javascript into each based on the contents of the page being viewed. The following code block works fine in hook_js_alter and hook_age_alter:

$tracking_code = generate_base_code();
  if (isset($tracking_code)) {
    $javascript = drupal_add_js($tracking_code, array(
        'type'       => 'inline',
        'every_page' => TRUE,
        'group'      => JS_DEFAULT,
        'weight'     => 10,
      )
    );
dpm($tracking_code, 'INSERTED BASE TRACKING CODE');

The javascript in $tracking_code appears in the page source and fires off properly if this block is in hook_js_alter and hook_age_alter. If I move it to any other function, user-defined or something like hook_commerce_cart_product_add, it doesn't appear in the page source nor does it fire off at any point. If I add this to the end:

dpm($javascript, "JAVASCRIPT");

The debug output shows it in the array, but, again, it's not in the page source. Also, the $javascript array only has 8 or so elements (with the supposedly inserted javascript at the end) instead of the usual 30-40 element array that comes with a dpm() of the $javascript array inside hook_js_alter. What gives? What am I doing wrong?

UPDATED: Here's one piece of code in particular that I'm talking about:

function blargh_commerce_cart_product_add($order, $product, $quantity, $line_item) {
  $item = array(
    'id'       => $product->sku,
    'name'     => $product->title,
    'category' => $product->type,
    'price'    => $product->commerce_price[LANGUAGE_NONE][0]['amount'] / 100,
    'quantity' => $quantity,
  );
  // blargh_send_addremove($item, 'add');

  $tracking_code = blargh_generate_base_code();
  if (isset($tracking_code)) {
    $javascript = drupal_add_js($tracking_code, array(
        'type'       => 'inline',
        'group'      => JS_DEFAULT,
        'weight'     => 20,
      )
    );
    // dpm($tracking_code, 'INSERTED BASE TRACKING CODE (hook_commerce_cart_product_add)');
  }
  $code = <<<HTML
ga('ec:addProduct', {
  'id': '{$item['id']}',
  'name': '{$item['name']}',
  'category': '{$item['category']}',
  'brand': '',
  'variant': '',
  'price': '{$item['price']}',
  'quantity': '{$item['quantity']}'
});
ga('ec:setAction', 'add');
HTML;
  $javascript = drupal_add_js($code, array(
      'type'   => 'inline',
      'group'  => JS_DEFAULT,
      'weight' => 20,
    )
  );
  // dpm($code, 'INSERTED TRACKING CODE (hook_commerce_cart_product_add)');
  // dpm($javascript, "JAVASCRIPT (hook_commerce_cart_product_add)");
}

The code that follows the line

// blargh_send_addremove($item, 'add');

was originally the blargh_send_addremove() function.  In this case, when the dpm statements are uncommented, they all show the added $tracking_code and $code in $javascript, but when I look at the page source, neither is present.


texts:
The problem I have is that it seems that I can use global variable created inside another module, only if I use it inside callback function. I successfully tested it by inserting code inside existing modules.

The global variable is $subtotal.

function uc_checkout_pane_simple_quote($op, &$arg1, $arg2) {
    global $subtotal;
drupal_set_message($subtotal);

function uc_webform_pane_checkout_pane_callback($nid, $op, &$arg1, $arg2) {
  global $subtotal;
  drupal_set_message($subtotal);
}

In both cases the message shows the correct value.

However, inside other functions it is does not work.

function uc_webform_pane_checkout_pane_alter(&$panes) {
  global $subtotal;
  drupal_set_message($subtotal);
}

function uc_cartdetails_checkout_pane_alter(&$panes) {
  global $user;
  global $subtotal;
  drupal_set_message($subtotal);
}

What am I missing here?
What I am trrying to do: to show or hide checkout pane based on $subtotal value.

function uc_cartdetails_checkout_pane_alter(&$panes) {
global $subtotal;
  foreach ($panes as &$pane) {

    if (($pane['id'] == 'webform_nid780') && ((40 - $subtotal) > 0) ) {
      $pane['enabled'] = FALSE;
      }

    }
 }


texts: How to get values of delta field from "block" table in drupal 7 from the database for the activated theme in a custom module?

texts:
Can I get all the values of delta field from "block" table from the database in my custom module

I have tried with this code as clive has explained it here but it shows me an error:

 $query = db_select('module__block', 'b')
  ->condition('theme', $business)
  ->condition('status', 1)
  ->condition('region', -1, '<>');

    $query->addExpression("CONCAT('_', delta)", 'delta');
    $deltas = $query->execute()->fetchCol();
    print_r($deltas);

module__block : Is the name of the block table since I attached a prefix to it.


texts: Is there a way to insert a view in a node form?

texts:
I have created a content-type based form (contact form) for anonymous users.
One of the fields in the form must displays a view.
This view is a slideshow view that displays different persons (site employees).

I want them to select an employee to where their comments will be delivered.


texts: Why does a header set via drupal_set_header() revert to text/html?

texts:
I'm using the views_rss module in Drupal 6. Whenever I build out a View using this plugin, the following header is sent in a template_preprocess function:

drupal_set_header('Content-Type: application/rss+xml; charset=utf-8');

This seems to be ignored, as the page is ultimately sent with a text/html header. It seems that my header is getting appended, but text/html is either sent first or last (whichever is ultimately interpreted by the browser) and thus has no effect.

How can I force a non-text/html header for a page output in Drupal 6?


texts: Rotate views results based on number of times viewed

texts: I have 10 images that I want to rotate within a views consisting of 6 viewable slots (my Views results). I want to rotate the 10 images so that each recieves (approx.) an equal number of views. The Node Statistics option added as a Sort Criteria does not work for this because you have to actually open and view the node itself for the counter to increment. What I want is for the counter to increment each time the images are shown from within the view.


texts: Customizing Search File Attachments result page

texts:
I'm using search_file_attachments module for my search, And also Search combine module to show all the results in one page. In the search results page, I like to maintain a structure. I need to show the node title instead of attached file name, and redirect to node url instead of attached file path when a user click on a result. So implement the template_preprocess_search_results() in my module overwrite the results. I tried to figure out the array result using devel.

function template_preprocess_search_result(&$variables) {
  dpm($variables);
}

And this my Devel results:

I cannot see any node details here, I guess this module only searching files in the folders. I'm finding a way to get the node details related to this results. Hope you guys got my question, Thanks in advance,


texts: CCK form to edit single field or set of fields

texts:
We have a fairly large CCK content type and would like to be able to edit a single field of the node at a time (or a set of fields).

For example, we will display our content on the page through a custom view, with a series of "edit" icons per row, allowing the user to edit an individual fields values.

Ideally we are aiming to have a popup with that fields form item(s), which the user can edit and click update.

Manipulating the form after build is not practical as its so much overhead just to render a form with a single field.

Is there a module that can render a form for one or a series of the fields for the given node?


texts: How do I remove the language_content_entity query from the canonical URL?

texts:
Following the Translating content documentation we have setup our site to have Spanish, English, and Japanese. When we are adding, editing, deleting, and publishing pages in different languages we have no issues. However, when we view the canonical url, we find that the language_content_entity=en is added for English pages, for example. We are already adding the hreflang to each page so don't need this extra parameter in the canonical.

For all English pages:

<link rel="canonical" href="https://www.somedomain.net/some/path?language_content_entity=en">

For all Spanish pages:

<link rel="canonical" href="https://www.somedomain.net/some/path?language_content_entity=es">

How can we remove the language_content_entity=en from the canonical url?


texts: filedownloading is making the file to view instead of download in drupal7

texts:
Hi i have followed Working with files in Drupal 7 and created the content type for file download.Everything is working fine i can upload a file and displaying it in the front page.But when i click on particular file for downloading it is just viewing the file in another tab in the browser with url like this

drupal7.22/sites/default/files/file.txt

I can view the file but not able to download it.Can you just say me where i did the mistake.


texts:
I want to add a condition of what type of space is currently active on the site. Does anyone know of a module that supports this?

I notice that spaces is setting a context for us, but I cannot find the relevant plugin or set the condition up in Context UI.

function spaces_set_space($space = NULL) {
  static $active_space;
  if (isset($space)) {
    $active_space = $space;
    if (module_exists('context') &&
        $plugin = context_get_plugin('condition','spaces_type')
        ) {
        $plugin->execute($space);
    }
  }
  return isset($active_space) ? $active_space : FALSE;
}


texts:
I have been working on a website that contains a main dropdown menu generated by Drupal (7.28). Is there any way I can add a link to it between the other links that shows content generated by me in the dropdown? So instead of: fetch pages, fetch something else (defined by me).

Thanks in advance =]


texts: Views selective filters show terms hierarchy

texts:
I'm using Views Selective Filters, trying to expose taxonomy terms filters with its depth/hierarchy.

Whenever I configure a filter with criterion Content, for instance Country (field_country) where field_country is a term, I have this extra setting window to choose the widget :

Instead, with the same field, but selective filter option, that extra settings window doesn't appear.

The Exposed form style is provided by Better Exposed Filters, but I let the default style for that filter.

Is there a configuration step I'm missing ? A necessary module combination to achieve that ? Meanwhile, I updated to Views selective filters dev version, plus a patch providing taxonomy weight ordering for the filters. This is the relevant part, from views_handler_filter_selective.inc :

/**
 * Get list of options for current view, only at runtime.
 */
protected function get_oids() {
//...
// Sort values.
  $sort_option = $this->options['selective_display_sort'];
  switch($sort_option) {
    case 'WEIGHT':
      $terms = taxonomy_term_load_multiple(array_keys($oids));
      usort($terms, function($a, $b) {
        return $a->weight - $b->weight;
      });
      $oids_ordered_by_weight = array();
      foreach ($terms as $term) {
        $oids_ordered_by_weight["$term->tid"] = $oids[$term->tid];
      }
      $oids = $oids_ordered_by_weight;
      break;
  }

And I'm trying now to figure out how to overwrite that to show hierarchy instead.


texts: Getting drush to install missing dependencies automatically into libraries

texts:
How to get drush to automatically install libraries or ignore dependencies?

Trying to automate enabling modules in batch with Drush

c:\2016\sites\all\modules>drush en views_slideshow_cycle -y
Module views_slideshow_cycle doesn't meet the requirements to be         [error]

enabled.
You need to install the jQuery cycle plugin. Create a directory in       [error]

sites/all/libraries called jquery.cycle, and then copy
jquery.cycle.all.min.js or jquery.cycle.all.js into it. You can find
the plugin at http://malsup.com/jquery/cycle. (Currently using jQuery
Cycle Library Library required for Views Slideshow Cycle)

c:\2016\sites\all\modules>


texts: How do I pull in a group of term descriptions instead of their names?

texts:
I am using a taxonomy to categorize content of type "lesson plan" by subject. Each lesson plan can belong to multiple subjects.

In a view where I display these lesson plans, I would like to have a field that lists all of the term's descriptions, rather than their names.

I followed these steps to pull in Taxonomy term: Term description instead of Content: Subject (where Subject is the name of the vocabulary) in the view.

However, in the Rewrite Results area, [description] only pulls in the first term's description, instead of all of them.

How do I get all of them?


texts: How do I use variables from config.ini.php?

texts:
I have a config.ini.php file as follows :

;<?php
;die(); // For further security
; // These php lines are used to hide the data from the browser
; // They are both valid php and valid ini files
;/*
; Don't forget to disable and reenable module, after adjusting the values
[folders]
var_1= "value1"
var_2 = "value2"

And in module_name.install file, I am using it as follows.

/**
 * Implementation of hook_enable().
 */
function module_name_enable() {
  $config_file = 'config.ini.php';
  $parameters = parse_ini_file($config_file);
  foreach ($parameters as $key => $value) {
    \Drupal::state()->set($key, $value);
    \Drupal::config('module_name.settings')
      ->set($key, $value)
      ->save();
  }
}

I then try to use a variable with the following code.

$getvar = \Drupal::config('module_name.settings')
      ->get('var_1');
\Drupal::state()->get('var_1', '');

I am not getting the value. What am I doing wrong?


texts: How can I show the root taxonomy term in a view field in Drupal 7?

texts:
I have a view with a taxonomy term field called Location in Drupal 7 and I want to show the first / root level of the term hierarchy in each view item field, aka the Country level.

My Location field in not mandatory, so I also want to show items with no Location. Meaning that I should mark all my term relationships as not required.

I have tried using relationship to the taxonomy term, and to the parent of the taxonomy term. And then a parent filter on the parent of the taxonomy term with value = empty. By this way I managed to show the root level of my taxonomy field only, but not items with no Location. As trying to make my relationship on taxonomy term not required, throws an exception. I guess this is due to the fact that then it tries to find the parent of the term and if it the term is empty, it throws the exception.

Any suggestions on how could I show the root term (Country) and, at the same time, items with no Location?


texts: Accidentally deleted sites/all/modules in Drupal 7

texts:
Let's say I was having a really rough day and I accidentally deleted the sites/all/modules directory in Drupal 7. Could I simply unzip my last back up of Drupal and copy that directory over to the server? Are there any other considerations or steps I should do and if this won't work, how should I go about fixing it? Thanks!

Running Drupal 7.50


texts: Link Taxonomy with Node via Feeds, Entity Reference and Views

texts:
I have a JSON feed that basically describes various objects described in an object lets say for example different cars.
In the feed, there is an object_type attribute that is just a number. Those numbers refer to different car brands which are described in a list object.

Thus the JSON Path is similar to:

$.object.object_type
$.list.id
$.list.name
// Where if 'object_type' == 'id', then display: 'name'

I've created 2 Feed Importers using JSONPath and was able to add my 'objects' (cars) to a custom node item (car_item) as well as to add my 'list' (of car brands) to a taxonomy vocabulary (brand_vocab). However I don't seem to be able to actually 'link/relate' them together.

For the brand_vocab, I have added an Entity Reference field (field_brand_id) and set the Target Type to be a Taxonomy Term (using Mode simple).
For my Feed Importer for car_item's, I`ve added the mapping for the json query to link to field_brand_id and set it to id for the query.

In fact, the taxonomy terms don't contain the filled in results for the id even though when I debug the Importer it all works fine.

Ideally I want my custom view to have a drop-down filter of the taxonomy terms (car brands) for the different custom nodes (car items). I have the view set-up, with the taxonomy vocob (brand_vocab) as a drop-down, just the filter doesn't work as the link between the node and taxonomy isn't working yet.

UPDATE: 10/01/2012

Ok so at the moment I have:

Feed Importer

Object (Cars)

Set as Custom content Type: Cars
Mapping for: name
Mapping for: brand

Object Type (Car Brands)

Set as Tax Term: object_type
Mapping for Term Name: name
Mapping for Term GUID: guid

Content Type

Cars

name
brand = Entity Reference
Target Type: Taxonomy Term - object_type

Now viewing the actual node for the Cars - I have the right Car Brand showing up as name and not the 'id' which is what I want.

However, the taxonomy term is not actually added to the Content type.

That and I have 2 Entity References that I need to use (Object Type and Category Type), however the content type shows both as the same term! So it seems to be that Entity Reference just checks the ID and then displays that and not the ID and Vocabulary (since I selected one ER to be for 1 Vocab bundle, and the other to be for another Vocab bundle).

What am I missing?


texts:
In my drupal 7 module which is separate from the node portion of drupal (discrete tables) I'm trying to use the array of 'attributes' to one  element of table using theme().

Here's a simple example:

$query = "SELECT projectID, title, housestaff_needed FROM Projects";
$result = db_query($query)->fetchAll();
$header = array('name' => t('Name'), 'title' => t('Title'), 'housestaff_needed' => t('Housestaff Needed'));

    foreach ($result as $item) {
      $rows[] = array(
          $item->title,
          $item->housestaff_needed,
          array('attributes' => array('id' => array('staff-' . $item->projectID))),
          );
    }
    $theme = theme('table', array('header' => $header, 'rows' => $rows));
    return $theme;

As you know, this only adds another  element after the housestaff_needed data. I've used this syntax before to enclose an entire table with an attribute, but I've read and read to see how this can be done on just an element but all I've read is how you can do it in the form api using '#attribute' which doesn't seem to be the same thing and a different setup outside the forms.

I'm trying to get this so I can identify this element for a jQuery scripted and can't get to first base. Please point out what I'm not doing correctly, thx, sam


texts: Why is my validate function not receiving the value of my form element?

texts:
function mymodule_email_reviewers_action_form($context) {
  $form = array();
    $form['email_text'] = array(
        '#type' => 'textarea',
        '#name' => 'message'
    );
    $form['submit'] = array(
        '#name' => '',
        '#type' => 'submit',
        '#value' => 'Apply'
    );
  return $form;
}

function mymodule_email_reviewers_action_validate($form, $form_state) {
    $text = $form_state['values']['email_text'];
    dsm($form_state);
    dsm($text);
    dsm($form);
    if ($text == 'Email body' || empty($text)) {
        form_set_error('email_text', t('Please enter a message'));
    }
}

I'm not sure what might be wrong here. Neither the $form nor $form_state contain the text I enter into my textarea.


texts: Would disabling core modules, which I don't need, speed up my site?

texts: Would disabling core modules which I don't need, like Color, speed up my site? If so, why?


texts:
By default, the user form title is the user's username which looks a little ugly if you're using the email registration module. In Drupal 7 I used to solve this problem using the title override module which is not ported do Drupal 8.

I would like to change the user form title to "Login details". Is this possible using a hook? If so: how do I do this?


texts: Show node if exists, else show node creation form

texts:
I would like to setup an environment where each of my users will be creating a node every day. I know all of my users won't be able to log in every day and they will want to check what they added on past days. I figured the best way to accomplish adding past days & displaying created content would be checking the url and returning either the node (if they have created one) or the node/add form if they have not.

For example, user 1234 navigates to:
url = example.com/user/1234/2011/09/10

If they have a node created with a date field set to this day it would show the node.  If not, it returns the node/add form with a hidden field set to the date in the url (easy, I can take care of that).

My first thought was panels/page manager, but I don't see a way to check if a node is created based on a date structure, if it can be accomplished I am all ears. If you think another solution is better... I am all ears!

EDIT: It has been brought to my attention that my original question overlooked a node type.  I might have more than one, and I could see this being useful for other people so lets say for arguments sake that the url looks like this:

example.com/user/1234/[node-type]/2011/09/10


texts:
I have a node type news with a taxonomy reference (news categories). And I have a view for the news. In this view I have a contextual filter by this categories. The category comes with the url.

In this view I need a rendered entity (node type "views header") within the view header. These node type also uses the taxonomy "news category". At this point all works fine.

BUT: for every news category I need another entity within the view header.

This approaches I have:

Adding all nodes of type "views header" in the view header and filter them in the same context as the view itself. I tried if it is filtered per default with the view context filter but is does not.

The BUT here: I don't know how. How I can filter the nodes in view header. Is there a module for it which I didn't find?

Publishing the view header nodes as blocks. Adding the blocks in views template and configure the block visibility settings pages/only the listed pages. This solution works but I think there's too much overhead.

Does anyone know a more elegant solution?


texts: How to make download file link to open form and mail the download link to email?

texts:
My flow is like that.

I have scroll-able list of download links for Private files.
When user click on Download File link it will show Form to gather
some data like first_name, last_name, email and Phone.
after submission Link will be forward to email Id specified in form
with KEY will check Once download the file link will be expire.
Second Mail goes to admin and Data will be stored to system as Sales
Lead.
File will be get to User.

I have created Views to List all the Files as a Block and  Link added to download file using yourdomain.com/get/file/1

Is there any suggestion for that or specific module tutorial available so, I can check...


texts: Tutorial for creating website using existing MySQL db?

texts:
I'm an experienced web developer, but I'm new to Drupal.

I have an existing MySQL database and I would like to build a website around it, with one page for each record in the main table. That would mean a few thousand pages for the site right from the start.

Are there any good tutorials that explain how to do this in Drupal?